mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-07 07:29:58 +01:00
file_util.cpp: Use _stat64 instead of stat where appropriate
Avoids compile failures introduced in an MSYS2 update
This commit is contained in:
parent
51dc3c6858
commit
33889fec1d
@ -119,7 +119,7 @@ bool Exists(const std::string& filename) {
|
|||||||
StripTailDirSlashes(copy);
|
StripTailDirSlashes(copy);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct stat file_info;
|
struct _stat64 file_info;
|
||||||
// Windows needs a slash to identify a driver root
|
// Windows needs a slash to identify a driver root
|
||||||
if (copy.size() != 0 && copy.back() == ':')
|
if (copy.size() != 0 && copy.back() == ':')
|
||||||
copy += DIR_SEP_CHR;
|
copy += DIR_SEP_CHR;
|
||||||
@ -140,18 +140,18 @@ bool IsDirectory(const std::string& filename) {
|
|||||||
return AndroidStorage::IsDirectory(filename);
|
return AndroidStorage::IsDirectory(filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct stat file_info;
|
|
||||||
|
|
||||||
std::string copy(filename);
|
std::string copy(filename);
|
||||||
StripTailDirSlashes(copy);
|
StripTailDirSlashes(copy);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
struct _stat64 file_info;
|
||||||
// Windows needs a slash to identify a driver root
|
// Windows needs a slash to identify a driver root
|
||||||
if (copy.size() != 0 && copy.back() == ':')
|
if (copy.size() != 0 && copy.back() == ':')
|
||||||
copy += DIR_SEP_CHR;
|
copy += DIR_SEP_CHR;
|
||||||
|
|
||||||
int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info);
|
int result = _wstat64(Common::UTF8ToUTF16W(copy).c_str(), &file_info);
|
||||||
#else
|
#else
|
||||||
|
struct stat file_info;
|
||||||
int result = stat(copy.c_str(), &file_info);
|
int result = stat(copy.c_str(), &file_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -397,9 +397,11 @@ u64 GetSize(const std::string& filename) {
|
|||||||
LOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename);
|
LOG_ERROR(Common_Filesystem, "failed {}: is a directory", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifndef _WIN32
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
struct _stat64 buf;
|
||||||
if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0)
|
if (_wstat64(Common::UTF8ToUTF16W(filename).c_str(), &buf) == 0)
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
u64 result = AndroidStorage::GetSize(filename);
|
u64 result = AndroidStorage::GetSize(filename);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user