| Index: base/sys_info_posix.cc
|
| ===================================================================
|
| --- base/sys_info_posix.cc (revision 2357)
|
| +++ base/sys_info_posix.cc (working copy)
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <errno.h>
|
| #include <string.h>
|
| +#include <sys/statvfs.h>
|
| #include <unistd.h>
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -15,6 +16,7 @@
|
| #endif
|
|
|
| #include "base/logging.h"
|
| +#include "base/string_util.h"
|
|
|
| namespace base {
|
|
|
| @@ -59,4 +61,13 @@
|
| #endif
|
| }
|
|
|
| +// static
|
| +int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) {
|
| + struct statvfs stats;
|
| + if (statvfs(WideToUTF8(path).c_str(), &stats) != 0) {
|
| + return 0;
|
| + }
|
| + return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
|
| +}
|
| +
|
| } // namespace base
|
|
|