diff options
| author | hrydgard <hrydgard@gmail.com> | 2008-12-09 22:54:57 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2008-12-09 22:54:57 +0000 |
| commit | 0e47a7986dc5cea404f0e7bc886848c6addafee4 (patch) | |
| tree | e368ee99103072ce2cb6cc9193b7bb5009d956a5 /Source/Core/Common/Src/FileUtil.cpp | |
| parent | e4505787109093658b23d0c2e5bc065d900ea839 (diff) | |
Fix filesize computation broken by XtraKrazzy in R1405
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1468 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.cpp | 19 |
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; } |
