summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/FileUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index 22bcc152f2..1714348e9e 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -319,17 +319,26 @@ std::string GetUserDirectory()
u64 GetSize(const char *filename)
{
- if(!Exists(filename))
+ if (!Exists(filename))
return 0;
-
+#ifdef _WIN32
+ // stat doesn't support 64-bit file sizes on Win32.
+ FILE *pFile = fopen(filename, "rb");
+ if (pFile)
+ {
+ fseek(pFile, 0, SEEK_END);
+ u64 pos = ftell(pFile);
+ fclose(pFile);
+ return pos;
+ }
+#else
struct stat buf;
if (stat(filename, &buf) == 0) {
return buf.st_size;
}
int err = errno;
-
- PanicAlert("Error accessing %s: %s", filename, strerror(err));
-
+ PanicAlert("Error accessing %s: %s", filename, strerror(err));
+#endif
return 0;
}