mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-26 09:06:19 +00:00
Fixed: CSystemInfo::availableHDSpace implementation under Unix
--HG-- branch : develop
This commit is contained in:
parent
6565603216
commit
35e3e27924
1 changed files with 2 additions and 5 deletions
|
@ -1387,13 +1387,10 @@ uint64 CSystemInfo::availableHDSpace (const string &filename)
|
||||||
std::string path = CFile::getPath(filename);
|
std::string path = CFile::getPath(filename);
|
||||||
|
|
||||||
#ifdef NL_OS_UNIX
|
#ifdef NL_OS_UNIX
|
||||||
struct stat stst;
|
|
||||||
struct statfs stfs;
|
struct statfs stfs;
|
||||||
|
if (::statfs(path.c_str(), &stfs) != 0) return 0;
|
||||||
|
|
||||||
if (::stat(path.c_str(), &stst) == -1) return 0;
|
return (uint64)(stfs.f_bavail * stfs.f_bsize);
|
||||||
if (::statfs(path.c_str(), &stfs) == -1) return 0;
|
|
||||||
|
|
||||||
return (uint64)(stfs.f_bavail * stst.st_blksize);
|
|
||||||
#else
|
#else
|
||||||
ULARGE_INTEGER freeSpace = {0};
|
ULARGE_INTEGER freeSpace = {0};
|
||||||
BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL);
|
BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue