mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
(Windows) Attempt implementing reading the file size without
relying on stat
This commit is contained in:
parent
1612333a68
commit
a99183e425
@ -100,20 +100,23 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size)
|
|||||||
if (cellFsStat(path, &buf) < 0)
|
if (cellFsStat(path, &buf) < 0)
|
||||||
return false;
|
return false;
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
struct stat buf;
|
WIN32_FILE_ATTRIBUTE_DATA file_info;
|
||||||
DWORD ret = GetFileAttributes(path);
|
DWORD ret = GetFileAttributes(path, 0, &file_info);
|
||||||
if (ret == INVALID_FILE_ATTRIBUTES)
|
if (ret == INVALID_FILE_ATTRIBUTES)
|
||||||
return false;
|
return false;
|
||||||
if (stat(path, &buf) < 0)
|
|
||||||
return false;
|
|
||||||
#else
|
#else
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (stat(path, &buf) < 0)
|
if (stat(path, &buf) < 0)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
if (size)
|
||||||
|
*size = file_info.nFileSizeLow;
|
||||||
|
#else
|
||||||
if (size)
|
if (size)
|
||||||
*size = buf.st_size;
|
*size = buf.st_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user