Chromium Code Reviews| Index: base/sys_info_posix.cc |
| diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc |
| index f2119cd7fdb538ebc34699088387aa2381e8cc4e..a7c72f21cc1ff5e1e6b60b1935f48990d570c78c 100644 |
| --- a/base/sys_info_posix.cc |
| +++ b/base/sys_info_posix.cc |
| @@ -50,6 +50,24 @@ int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { |
| return static_cast<int64>(stats.f_bavail) * stats.f_frsize; |
| } |
| +// static |
| +int SysInfo::GetMaximumPathComponentLength(const FilePath& path) { |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| + if (!path.IsAbsolute()) |
|
Mark Mentovai
2013/02/08 18:14:02
I don’t think this is relevant to the API. Maximum
kinaba
2013/02/12 05:51:29
Done.
|
| + return -1; |
| + |
| + struct statvfs stats; |
| + if (statvfs(path.value().c_str(), &stats) != 0) { |
|
Mark Mentovai
2013/02/08 18:14:02
On Mac OS X, you need to use pathconf(…, _PC_NAME_
kinaba
2013/02/12 05:51:29
Thanks for catching it! That greatly simplifies th
|
| + return -1; |
| + } |
| +#if defined(OS_ANDROID) |
| + // Android uses statfs instead of statvfs. The field name differs. |
|
Mark Mentovai
2013/02/08 18:14:02
If you’re sticking with statfs for any code…
Hide
kinaba
2013/02/12 05:51:29
Done (using pathconf).
|
| + return static_cast<int>(stats.f_namelen); |
| +#else |
| + return static_cast<int>(stats.f_namemax); |
| +#endif |
| +} |
| + |
| #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| // static |
| std::string SysInfo::OperatingSystemName() { |