mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-01 18:41:00 +00:00
* BugFix: Correct non-constant array allocations in the POSIX case insensitivity code.
This commit is contained in:
parent
497a94f884
commit
444c9dcf41
|
|
@ -157,7 +157,7 @@ FileNodeRef PosixFileSystem::resolve(const Path& path)
|
|||
#ifdef TORQUE_POSIX_PATH_CASE_INSENSITIVE
|
||||
// Resolve the case sensitive filepath
|
||||
String::SizeType fileLength = file.length();
|
||||
UTF8 caseSensitivePath[fileLength + 1];
|
||||
UTF8* caseSensitivePath = new UTF8[fileLength + 1];
|
||||
dMemcpy(caseSensitivePath, file.c_str(), fileLength);
|
||||
caseSensitivePath[fileLength] = 0x00;
|
||||
ResolvePathCaseInsensitive(caseSensitivePath, fileLength);
|
||||
|
|
@ -167,17 +167,21 @@ FileNodeRef PosixFileSystem::resolve(const Path& path)
|
|||
String caseSensitiveFile = file;
|
||||
#endif
|
||||
|
||||
FileNodeRef result = 0;
|
||||
if (stat(caseSensitiveFile.c_str(),&info) == 0)
|
||||
{
|
||||
// Construct the appropriate object
|
||||
if (S_ISREG(info.st_mode))
|
||||
return new PosixFile(path,caseSensitiveFile);
|
||||
result = new PosixFile(path,caseSensitiveFile);
|
||||
|
||||
if (S_ISDIR(info.st_mode))
|
||||
return new PosixDirectory(path,caseSensitiveFile);
|
||||
result = new PosixDirectory(path,caseSensitiveFile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#ifdef TORQUE_POSIX_PATH_CASE_INSENSITIVE
|
||||
delete[] caseSensitivePath;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
FileNodeRef PosixFileSystem::create(const Path& path, FileNode::Mode mode)
|
||||
|
|
|
|||
|
|
@ -1286,7 +1286,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
|||
{
|
||||
#ifdef TORQUE_POSIX_PATH_CASE_INSENSITIVE
|
||||
dsize_t pathLength = dStrlen(path);
|
||||
char caseSensitivePath[pathLength + 1];
|
||||
char* caseSensitivePath = new char[pathLength + 1];
|
||||
|
||||
// Load path into temporary buffer
|
||||
dMemcpy(caseSensitivePath, path, pathLength);
|
||||
|
|
@ -1298,6 +1298,10 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
|||
|
||||
bool retVal = recurseDumpDirectories(caseSensitivePath, "", directoryVector, -1, depth, noBasePath);
|
||||
clearExcludedDirectories();
|
||||
|
||||
#ifdef TORQUE_POSIX_PATH_CASE_INSENSITIVE
|
||||
delete[] caseSensitivePath;
|
||||
#endif
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue