fileDelete() woes
by Harry Durnan · in Torque Game Builder · 07/07/2012 (6:32 pm) · 3 replies
While trying to wrap up a few final features on my project, one of which was to allow the player to delete old saved games inside the game itself, I found the fileDelete function doesn't seem to behave like other file fuctions. After slogging through the forums, it seems that it requires the explicit file path be passed to it.
I haven't been able to find anything on this, but is there any value that stores the "user" directory? (I.E. "C:Users\Harry\AppData\Roaming\Independent\<game title>") Or, do I need to slog through TGB engine code to try to figure a better way to delete my save game files? :o
I haven't been able to find anything on this, but is there any value that stores the "user" directory? (I.E. "C:Users\Harry\AppData\Roaming\Independent\<game title>") Or, do I need to slog through TGB engine code to try to figure a better way to delete my save game files? :o
About the author
Author of It's A Wipe! (http://www.iawgame.com :)
#2
If anyone has any better ideas on doing this, I'd be happy to do this in a cleaner fashion.
07/08/2012 (10:51 am)
This still has a bit of an issue where the resourceManager seems to hold onto the deleted file... isFile() still returns true on deleted files :/ There's old threads that say to do setModPaths(getModPaths()) to refresh the file list, but this seems to completely remove access to the Appdata folder. I added yet another hackey work around to try to open the files for read whenever I look for them, since that fails on the deleted ones. It's not perfect... but it kind of works.If anyone has any better ideas on doing this, I'd be happy to do this in a cleaner fashion.
#3
I've had a file detection problem too and it appears to be too painful to edit fileDelete itself but adding this function in "fileSystemFunctions.cpp"
Should do the trick. Then you just call this function in TorqueScript
EDIT: Huh. I Forgot that posting would bump it up in the normal forums too...
09/19/2012 (10:18 pm)
I know it's been a bit but I almost never look in the Bug Submissions area.I've had a file detection problem too and it appears to be too painful to edit fileDelete itself but adding this function in "fileSystemFunctions.cpp"
ConsoleFunction( refreshFileDirectory, void, 1, 1, "Refreshes directory dynamically so the game recognizes new files added (or the lack thereof) after game start." )
{
ResourceManager->setWriteablePath(Platform::getCurrentDirectory());
ResourceManager->addPath( Platform::getCurrentDirectory() );
}Should do the trick. Then you just call this function in TorqueScript
refreshFileDirectory();
EDIT: Huh. I Forgot that posting would bump it up in the normal forums too...
Torque 3D Owner Harry Durnan