fixing no unity builds

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-03 20:24:36 -07:00
parent 82c5f80fbd
commit eeed7df429
9 changed files with 33 additions and 3 deletions
+23 -2
View File
@@ -1648,12 +1648,33 @@ DWORD GetFileAttributes(LPCWSTR lpFileNameW)
uint32 CryGetFileAttributes(const char* lpFileName)
{
AZStd::string fn = lpFileName;
adaptFilenameToLinux(fn);
const char* buffer = fn.c_str();
return GetFileAttributes(buffer);
struct stat fileStats;
const int success = stat(buffer, &fileStats);
if (success == -1)
{
char adjustedFilename[MAX_PATH];
GetFilenameNoCase(buffer, adjustedFilename);
if (stat(adjustedFilename, &fileStats) == -1)
{
return (DWORD)INVALID_FILE_ATTRIBUTES;
}
}
DWORD ret = 0;
const int acc = (fileStats.st_mode & S_IWRITE);
if (acc != 0)
{
if (S_ISDIR(fileStats.st_mode) != 0)
{
ret |= FILE_ATTRIBUTE_DIRECTORY;
}
}
return (ret == 0) ? FILE_ATTRIBUTE_NORMAL : ret;//return file attribute normal as the default value, must only be set if no other attributes have been found
}
__finddata64_t::~__finddata64_t()