mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
* Adjustment: Change several filesystem functions to use the VFS.
* Feature: Initial implementation of a VFS dump directories function.
This commit is contained in:
parent
948bc43d85
commit
cbe7ee13d6
5 changed files with 130 additions and 42 deletions
|
|
@ -368,15 +368,11 @@ DefineEngineFunction(getFileCRC, S32, ( const char* fileName ),,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String cleanfilename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode( givenPath );
|
||||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode( fileName );
|
||||
|
||||
if ( fileRef == NULL )
|
||||
{
|
||||
Con::errorf("getFileCRC() - could not access file: [%s]", givenPath.getFullPath().c_str() );
|
||||
Con::errorf("getFileCRC() - could not access file: [%s]", fileName );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -391,11 +387,7 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String cleanfilename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
return Torque::FS::IsFile(givenPath);
|
||||
return Torque::FS::IsFile(fileName);
|
||||
}
|
||||
|
||||
DefineEngineFunction(isScriptFile, bool, (const char* fileName), ,
|
||||
|
|
@ -406,11 +398,7 @@ DefineEngineFunction(isScriptFile, bool, (const char* fileName), ,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String cleanfilename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
return Torque::FS::IsScriptFile(givenPath.getFullPath());
|
||||
return Torque::FS::IsScriptFile(fileName);
|
||||
}
|
||||
|
||||
DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
||||
|
|
@ -423,11 +411,7 @@ DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String dir(Torque::Path::CleanSeparators(directory));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), dir.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
return Torque::FS::IsDirectory( givenPath );
|
||||
return Torque::FS::IsDirectory( directory );
|
||||
}
|
||||
|
||||
DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
||||
|
|
@ -438,14 +422,7 @@ DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
|||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String filename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), filename.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
Torque::FS::FileSystemRef fs = Torque::FS::GetFileSystem(givenPath);
|
||||
Torque::Path path = fs->mapTo(givenPath);
|
||||
|
||||
return !Torque::FS::IsReadOnly(path);
|
||||
return !Torque::FS::IsReadOnly(fileName);
|
||||
}
|
||||
|
||||
DefineEngineFunction(startFileChangeNotifications, void, (),,
|
||||
|
|
@ -840,7 +817,11 @@ DefineEngineFunction( getCurrentDirectory, String, (),,
|
|||
"@see getWorkingDirectory()"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
#ifdef TORQUE_SECURE_VFS
|
||||
return Torque::FS::GetCwd();
|
||||
#else
|
||||
return Platform::getCurrentDirectory();
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -853,8 +834,11 @@ DefineEngineFunction( setCurrentDirectory, bool, ( const char* path ),,
|
|||
"@note Only present in a Tools build of Torque.\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
#ifdef TORQUE_SECURE_VFS
|
||||
return Torque::FS::SetCwd(path);
|
||||
#else
|
||||
return Platform::setCurrentDirectory( StringTable->insert( path ) );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue