Open
Description
- I tested it on latest raylib version from master branch
- I checked there is no similar issue already reported
- I checked the documentation on the wiki
- My code has no errors or misuse of raylib
Issue description
As-per discussion here the filesystem callbacks are useful and work great, when trying to implement a virtual filesystem (I am using physfs), but there are still some functions without hooks or macros that need to some way to be overwritten:
FileExists
DirectoryExists
GetFileLength
ChangeDirectory
IsPathFile
LoadDirectoryFiles
LoadDirectoryFilesEx
GetFileModTime
I made a little library here and just added FS
to the end of the names, to prevent collision. Also @RobLoach made raylib-physfs, which doesn't use callbacks, but takes a similar naming-approach.
I think either a macro or the callback-system are fine, I just need a way to overwrite these, so when the user calls FileExists
it calls PHYSFS_stat
.
I am happy to PR for a macro or callback, whatever everyone thinks is better.
Code Example
It might look like either of these:
bool FileExistsPhysFS(const char *fileName) {
PHYSFS_Stat stat;
if (!PHYSFS_stat(fileName, &stat)) return false;
return stat.filetype == PHYSFS_FILETYPE_REGULAR;
}
// later
SetFileExistsCallback(FileExistsPhysFS);
// OR
#define RL_FS_FILE_EXISTS FileExistsPhysFS