mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Fixes the recursive directory dump in the Linux platform code so that module/asset parsing works as expected.
This commit is contained in:
parent
510b726f6f
commit
e48ee1a03a
1 changed files with 65 additions and 31 deletions
|
|
@ -1151,45 +1151,79 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
||||||
DIR *dip;
|
DIR *dip;
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
|
|
||||||
if (subPath && (dStrncmp(subPath, "", 1) != 0))
|
dsize_t trLen = basePath ? dStrlen(basePath) : 0;
|
||||||
{
|
dsize_t subtrLen = subPath ? dStrlen(subPath) : 0;
|
||||||
if ((basePath[dStrlen(basePath) - 1]) == '/')
|
char trail = trLen > 0 ? basePath[trLen - 1] : '\0';
|
||||||
dSprintf(Path, 1024, "%s%s", basePath, subPath);
|
char subTrail = subtrLen > 0 ? subPath[subtrLen - 1] : '\0';
|
||||||
else
|
char subLead = subtrLen > 0 ? subPath[0] : '\0';
|
||||||
dSprintf(Path, 1024, "%s/%s", basePath, subPath);
|
|
||||||
}
|
if (trail == '/')
|
||||||
|
{
|
||||||
|
if (subPath && (dStrncmp(subPath, "", 1) != 0))
|
||||||
|
{
|
||||||
|
if (subTrail == '/')
|
||||||
|
dSprintf(Path, 1024, "%s%s", basePath, subPath);
|
||||||
|
else
|
||||||
|
dSprintf(Path, 1024, "%s%s/", basePath, subPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dSprintf(Path, 1024, "%s", basePath);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
dSprintf(Path, 1024, "%s", basePath);
|
{
|
||||||
|
if (subPath && (dStrncmp(subPath, "", 1) != 0))
|
||||||
|
{
|
||||||
|
if (subTrail == '/')
|
||||||
|
dSprintf(Path, 1024, "%s%s", basePath, subPath);
|
||||||
|
else
|
||||||
|
dSprintf(Path, 1024, "%s%s/", basePath, subPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dSprintf(Path, 1024, "%s/", basePath);
|
||||||
|
}
|
||||||
|
|
||||||
dip = opendir(Path);
|
dip = opendir(Path);
|
||||||
if (dip == NULL)
|
if (dip == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// add path to our return list ( provided it is valid )
|
// add path to our return list ( provided it is valid )
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
if (!Platform::isExcludedDirectory(subPath))
|
if (!Platform::isExcludedDirectory(subPath))
|
||||||
{
|
{
|
||||||
if (noBasePath)
|
if (noBasePath)
|
||||||
{
|
{
|
||||||
// We have a path and it's not an empty string or an excluded directory
|
// We have a path and it's not an empty string or an excluded directory
|
||||||
if ( (subPath && (dStrncmp (subPath, "", 1) != 0)) )
|
if ( (subPath && (dStrncmp (subPath, "", 1) != 0)) )
|
||||||
directoryVector.push_back(StringTable->insert(subPath));
|
directoryVector.push_back(StringTable->insert(subPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (subPath && (dStrncmp(subPath, "", 1) != 0)) )
|
if ( (subPath && (dStrncmp(subPath, "", 1) != 0)) )
|
||||||
{
|
{
|
||||||
char szPath[1024];
|
char szPath[1024];
|
||||||
dMemset(szPath, 0, 1024);
|
dMemset(szPath, 0, 1024);
|
||||||
if ( (basePath[dStrlen(basePath) - 1]) != '/')
|
if (trail == '/')
|
||||||
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
{
|
||||||
else
|
if ((basePath[dStrlen(basePath) - 1]) != '/')
|
||||||
dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);
|
dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);
|
||||||
directoryVector.push_back(StringTable->insert(szPath));
|
else
|
||||||
}
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
else
|
}
|
||||||
directoryVector.push_back(StringTable->insert(basePath));
|
else
|
||||||
}
|
{
|
||||||
}
|
if ((basePath[dStrlen(basePath) - 1]) != '/')
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
|
else
|
||||||
|
dSprintf(szPath, 1024, "%s/%s", basePath, subPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
directoryVector.push_back(StringTable->insert(szPath));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
directoryVector.push_back(StringTable->insert(basePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Iterate through and grab valid directories
|
// Iterate through and grab valid directories
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue