[*] Update GetSystemResourcePath to check package path before user rw directories

This commit is contained in:
Reece Wilson 2024-03-11 21:22:24 +00:00
parent db1ff0cbf8
commit 0f4a7bf8cb

View File

@ -72,6 +72,7 @@ namespace Aurora::IO::FS
return false;
}
#if defined(AU_CFG_ID_INTERNAL) || defined(AU_CFG_ID_DEBUG)
{
AuString tempPath;
if (Process::GetWorkingDirectory(tempPath))
@ -84,6 +85,7 @@ namespace Aurora::IO::FS
}
}
}
#endif
{
if (auto pProcPath = Process::GetProcessDirectory())
@ -97,6 +99,46 @@ namespace Aurora::IO::FS
}
}
{
if (auto optPackagePath = GetPackagePath())
{
auto tempPath = *optPackagePath + "/" + fileName;
if (auto pProcPath = Process::GetProcessDirectory())
{
auto tempPath2 = *pProcPath + "/" + fileName;
if (tempPath2 == tempPath)
{
// nop
}
else if (FileExists(tempPath))
{
path = tempPath;
return true;
}
}
else if (FileExists(tempPath))
{
path = tempPath;
return true;
}
}
}
#if defined(AU_CFG_ID_SHIP)
{
AuString tempPath;
if (Process::GetWorkingDirectory(tempPath))
{
tempPath += "/" + fileName;
if (FileExists(tempPath))
{
path = tempPath;
return true;
}
}
}
#endif
{
auto systemPath = gHomeDirectory + fileName;