mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +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,18 +1151,41 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
||||||
DIR *dip;
|
DIR *dip;
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
|
|
||||||
|
dsize_t trLen = basePath ? dStrlen(basePath) : 0;
|
||||||
|
dsize_t subtrLen = subPath ? dStrlen(subPath) : 0;
|
||||||
|
char trail = trLen > 0 ? basePath[trLen - 1] : '\0';
|
||||||
|
char subTrail = subtrLen > 0 ? subPath[subtrLen - 1] : '\0';
|
||||||
|
char subLead = subtrLen > 0 ? subPath[0] : '\0';
|
||||||
|
|
||||||
|
if (trail == '/')
|
||||||
|
{
|
||||||
if (subPath && (dStrncmp(subPath, "", 1) != 0))
|
if (subPath && (dStrncmp(subPath, "", 1) != 0))
|
||||||
{
|
{
|
||||||
if ((basePath[dStrlen(basePath) - 1]) == '/')
|
if (subTrail == '/')
|
||||||
dSprintf(Path, 1024, "%s%s", basePath, subPath);
|
dSprintf(Path, 1024, "%s%s", basePath, subPath);
|
||||||
else
|
else
|
||||||
dSprintf(Path, 1024, "%s/%s", basePath, subPath);
|
dSprintf(Path, 1024, "%s%s/", basePath, subPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dSprintf(Path, 1024, "%s", basePath);
|
dSprintf(Path, 1024, "%s", basePath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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 )
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -1180,10 +1203,21 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
|
||||||
{
|
{
|
||||||
char szPath[1024];
|
char szPath[1024];
|
||||||
dMemset(szPath, 0, 1024);
|
dMemset(szPath, 0, 1024);
|
||||||
|
if (trail == '/')
|
||||||
|
{
|
||||||
|
if ((basePath[dStrlen(basePath) - 1]) != '/')
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);
|
||||||
|
else
|
||||||
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ((basePath[dStrlen(basePath) - 1]) != '/')
|
if ((basePath[dStrlen(basePath) - 1]) != '/')
|
||||||
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
dSprintf(szPath, 1024, "%s%s", basePath, subPath);
|
||||||
else
|
else
|
||||||
dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);
|
dSprintf(szPath, 1024, "%s/%s", basePath, subPath);
|
||||||
|
}
|
||||||
|
|
||||||
directoryVector.push_back(StringTable->insert(szPath));
|
directoryVector.push_back(StringTable->insert(szPath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue