BASE: FSNode or DefaultSaveFileManager should provide an overloadable remove file method.
|Reported by:||carlo-bramini||Owned by:||criezy|
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.
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?
Change History (7)
comment:4 by , 2 years ago
|Resolution:||wontfix → assigned|
|Status:||closed → pending|
|Summary:||BASE: FSNode should provide also a "remove" method. → BASE: FSNode or DefaultSaveFileManager should provide an overloadable remove file method.|