Fix filesize computation broken by XtraKrazzy in R1405
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1468 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e450578710
commit
0e47a7986d
|
@ -319,17 +319,26 @@ std::string GetUserDirectory()
|
||||||
|
|
||||||
u64 GetSize(const char *filename)
|
u64 GetSize(const char *filename)
|
||||||
{
|
{
|
||||||
if(!Exists(filename))
|
if (!Exists(filename))
|
||||||
return 0;
|
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;
|
struct stat buf;
|
||||||
if (stat(filename, &buf) == 0) {
|
if (stat(filename, &buf) == 0) {
|
||||||
return buf.st_size;
|
return buf.st_size;
|
||||||
}
|
}
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
PanicAlert("Error accessing %s: %s", filename, strerror(err));
|
||||||
PanicAlert("Error accessing %s: %s", filename, strerror(err));
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue