* Feature: Initial testing with module (file) searches.

This commit is contained in:
Robert MacGregor 2022-05-17 18:04:19 -04:00
parent c3540acf94
commit 9901fa76b4
21 changed files with 142 additions and 1215 deletions

View file

@ -97,11 +97,11 @@ static S32 buildFileList(const char* pattern, bool recurse, bool multiMatch)
Torque::FS::FileSystemRef fs = Torque::FS::GetFileSystem(givenPath);
//Torque::Path path = fs->mapTo(givenPath);
Torque::Path path = givenPath;
// Make sure that we have a root so the correct file system can be determined when using zips
if(givenPath.isRelative())
path = Torque::Path::Join(Torque::FS::GetCwd(), '/', givenPath);
path.setFileName(String::EmptyString);
path.setExtension(String::EmptyString);
if(!Torque::FS::IsDirectory(path))
@ -361,11 +361,11 @@ DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool rec
DefineEngineFunction(getFileCRC, S32, ( const char* fileName ),,
"@brief Provides the CRC checksum of the given file.\n\n"
"@param fileName The path to the file.\n"
"@return The calculated CRC checksum of the file, or -1 if the file "
"could not be found.\n"
"@ingroup FileSystem")
{
String cleanfilename(Torque::Path::CleanSeparators(fileName));
@ -385,10 +385,10 @@ DefineEngineFunction(getFileCRC, S32, ( const char* fileName ),,
DefineEngineFunction(isFile, bool, ( const char* fileName ),,
"@brief Determines if the specified file exists or not\n\n"
"@param fileName The path to the file.\n"
"@return Returns true if the file was found.\n"
"@ingroup FileSystem")
{
String cleanfilename(Torque::Path::CleanSeparators(fileName));
@ -556,13 +556,13 @@ DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),,
Platform::getFileTimes( sgScriptFilenameBuffer, NULL, &ft );
Platform::LocalTime lt = {0};
Platform::fileToLocalTime( ft, &lt );
Platform::fileToLocalTime( ft, &lt );
String fileStr = Platform::localTimeToString( lt );
char *buffer = Con::getReturnBuffer( fileStr.size() );
dStrcpy( buffer, fileStr, fileStr.size() );
return buffer;
}
@ -579,7 +579,7 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
Platform::getFileTimes( sgScriptFilenameBuffer, &ft, NULL );
Platform::LocalTime lt = {0};
Platform::fileToLocalTime( ft, &lt );
Platform::fileToLocalTime( ft, &lt );
String fileStr = Platform::localTimeToString( lt );
@ -841,7 +841,7 @@ DefineEngineFunction( pathCopy, bool, ( const char* fromFile, const char* toFile
{
char qualifiedFromFile[ 2048 ];
char qualifiedToFile[ 2048 ];
Platform::makeFullPathName( fromFile, qualifiedFromFile, sizeof( qualifiedFromFile ) );
Platform::makeFullPathName( toFile, qualifiedToFile, sizeof( qualifiedToFile ) );