Hi all,
A small post to let you know about some of the changes I've made to the orxFile API recently (only in the thread branch so far):
- Added orxFile_MakeDirectory() and it works recursively (ie. if intermediate directories don't exist, they'll get created as well, not just the last one)
- Added orxFile_Remove(), which works on both files and empty directories
- orxFile_Open(), when used with the write and/or append flag will now create intermediate directories if they don't already exist
- orxFile_FindFirst/orxFile_FindNext now return an orxSTATUS instead of an orxBOOL
- Added orxFile_GetHomeDirectory(), which returns a user's home directory when applicable (ie. it will return an empty string on iOS/Android)
- Added orxFile_GetApplicationSaveDirectory(), which is probably the most important change made recently. This will give you the root directory where anything an application want to save on disk should go.
It works on all platform and will be a per-user directory when applicable, ie. not on iOS and I'm not sure about Android ;)
On Windows it'll use the Application Roaming directory instead of the Local one.
The other good thing about the last 2 new functions, is that they take an argument that will be concatenated at the end of the path. This way, it's easy to directly get a full path to a savegame file, for example:
const orxSTRING zSaveFile = orxFile_GetApplicationSaveDirectory("Company/Game/Save.ini");
For example, on Linux, this will return something like "/users/home/iarwain/.local/share/Company/Game/Save.ini".
Even if this file doesn't exist or if any sub-directory is missing in the path, calling:
orxFile_Open(zSaveFile, orxFILE_KU32_FLAG_OPEN_WRITE);
should create all the missing sub-directories and create the file Save.ini where expected.
Lemme know if you have any questions/comments! =)
Cheers,
Rom