[Scummvm-tracker] [ScummVM :: Bugs] #12975: BASE: FSNode should provide also a "remove" method.

ScummVM :: Bugs trac at scummvm.org
Sat Oct 2 10:52:46 UTC 2021


#12975: BASE: FSNode should provide also a "remove" method.
--------------------------+--------------------
Reporter:  carlo-bramini  |      Owner:  (none)
    Type:  defect         |     Status:  new
Priority:  normal         |  Component:  Common
 Version:                 |   Keywords:
    Game:                 |
--------------------------+--------------------
 While working on my WinCE port of SCUMMVM, I got a problem with the use of
 remove() function from backends\saves\default\default-saves.cpp.
 I could easily bypass the trouble by writing a simple wrapper that
 emulates remove() by calling DeleteFile().
 However, by looking the current code at time of writing, you can see this
 text:

 {{{
 // FIXME: remove does not exist on all systems. If your port fails to
 // compile because of this, please let us know (scummvm-devel).
 // There is a nicely portable workaround, too: Make this method
 overloadable.
 }}}

 https://github.com/scummvm/scummvm/blob/7dba6016361eadc8ae44c91604f0e87081591cdb/backends/saves/default
 /default-saves.cpp#L208

 So, I'm wondering what you will think about adding a "remove" method (or
 similar, the name itself is not too important...) to Common::FSNode for
 doing this task. The default will use the usual remove() function from C
 library, while (for example) the ports for Windows may be able to call the
 DeleteFile() API.

 By looking the code, it seems to me that this would be helpful also for
 the port for devices running Symbian OS: here there is the problem that
 "remove" is a macro defined to unlink(), rather than a true function. So,
 instead of defining SYMBIAN_USE_SYSTEM_REMOVE to undefine the "remove"
 macro on your needs, you can safely leave it always undefined when you are
 compiling for this platform and the dedicated code into
 backends\fs\symbian\symbian-fs.cpp will simply need to use unlink() when
 implementing this additional method.

 This will make the common code easier to read and to maintain, in my
 opinion.

 What do you think?

 Sincerely.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/12975>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list