| Index: base/sys_info_win.cc
|
| diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
|
| index d2c7bcddc148d1693946fbb26086f676f85b1423..7ffb8e1a13c79bd3f2c2ed29938677865d198805 100644
|
| --- a/base/sys_info_win.cc
|
| +++ b/base/sys_info_win.cc
|
| @@ -56,14 +56,29 @@ int64_t SysInfo::AmountOfVirtualMemory() {
|
|
|
| // static
|
| int64_t SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
|
| + int64_t available, unused;
|
| + if (!GetDiskSpaceInfo(path, &available, &unused))
|
| + return -1;
|
| + return available;
|
| +}
|
| +
|
| +// static
|
| +bool SysInfo::GetDiskSpaceInfo(const FilePath& path,
|
| + int64_t* available_bytes,
|
| + int64_t* total_bytes) {
|
| ThreadRestrictions::AssertIOAllowed();
|
|
|
| ULARGE_INTEGER available, total, free;
|
| if (!GetDiskFreeSpaceExW(path.value().c_str(), &available, &total, &free))
|
| - return -1;
|
| -
|
| - int64_t rv = static_cast<int64_t>(available.QuadPart);
|
| - return rv < 0 ? std::numeric_limits<int64_t>::max() : rv;
|
| + return false;
|
| +
|
| + *available_bytes = static_cast<int64_t>(available.QuadPart);
|
| + if (*available_bytes < 0)
|
| + *available_bytes = std::numeric_limits<int64_t>::max();
|
| + *total_bytes = static_cast<int64_t>(total.QuadPart);
|
| + if (*total_bytes < 0)
|
| + *total_bytes = std::numeric_limits<int64_t>::max();
|
| + return true;
|
| }
|
|
|
| std::string SysInfo::OperatingSystemName() {
|
|
|