mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
FileSystem: Fix size being unfilled on Linux
Fixes BIOS detection.
This commit is contained in:
parent
78f06fb711
commit
cd0199a07a
|
@ -1200,6 +1200,7 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate results
|
// iterate results
|
||||||
|
PathString full_path;
|
||||||
struct dirent* pDirEnt;
|
struct dirent* pDirEnt;
|
||||||
while ((pDirEnt = readdir(pDir)) != nullptr)
|
while ((pDirEnt = readdir(pDir)) != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1215,17 +1216,28 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ParentPath != nullptr)
|
||||||
|
full_path.Format("%s/%s/%s/%s", OriginPath, ParentPath, Path, pDirEnt->d_name);
|
||||||
|
else if (Path != nullptr)
|
||||||
|
full_path.Format("%s/%s/%s", OriginPath, Path, pDirEnt->d_name);
|
||||||
|
else
|
||||||
|
full_path.Format("%s/%s", OriginPath, pDirEnt->d_name);
|
||||||
|
|
||||||
FILESYSTEM_FIND_DATA outData;
|
FILESYSTEM_FIND_DATA outData;
|
||||||
outData.Attributes = 0;
|
outData.Attributes = 0;
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
struct stat sDir;
|
struct stat sDir;
|
||||||
|
if (stat(full_path, &sDir) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
stat(pDirEnt->d_name, &sDir);
|
|
||||||
if (S_ISDIR(sDir.st_mode))
|
|
||||||
#else
|
#else
|
||||||
if (pDirEnt->d_type == DT_DIR)
|
struct stat64 sDir;
|
||||||
|
if (stat64(full_path, &sDir) < 0)
|
||||||
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (S_ISDIR(sDir.st_mode))
|
||||||
{
|
{
|
||||||
if (Flags & FILESYSTEM_FIND_RECURSIVE)
|
if (Flags & FILESYSTEM_FIND_RECURSIVE)
|
||||||
{
|
{
|
||||||
|
@ -1252,8 +1264,7 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
|
outData.Size = static_cast<u64>(sDir.st_size);
|
||||||
// outData.Attributes |= FILESYSTEM_FILE_ATTRIBUTE_READ_ONLY;
|
|
||||||
|
|
||||||
// match the filename
|
// match the filename
|
||||||
if (hasWildCards)
|
if (hasWildCards)
|
||||||
|
@ -1271,13 +1282,7 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||||
// TODO string formatter, clean this mess..
|
// TODO string formatter, clean this mess..
|
||||||
if (!(Flags & FILESYSTEM_FIND_RELATIVE_PATHS))
|
if (!(Flags & FILESYSTEM_FIND_RELATIVE_PATHS))
|
||||||
{
|
{
|
||||||
if (ParentPath != nullptr)
|
outData.FileName = std::string(full_path);
|
||||||
outData.FileName =
|
|
||||||
StringUtil::StdStringFromFormat("%s/%s/%s/%s", OriginPath, ParentPath, Path, pDirEnt->d_name);
|
|
||||||
else if (Path != nullptr)
|
|
||||||
outData.FileName = StringUtil::StdStringFromFormat("%s/%s/%s", OriginPath, Path, pDirEnt->d_name);
|
|
||||||
else
|
|
||||||
outData.FileName = StringUtil::StdStringFromFormat("%s/%s", OriginPath, pDirEnt->d_name);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue