| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
| 6 // filesystem. | 6 // filesystem. |
| 7 | 7 |
| 8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
| 9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
| 10 | 10 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // Is |path| writable only by a user with administrator privileges? | 415 // Is |path| writable only by a user with administrator privileges? |
| 416 // This function uses Mac OS conventions. The super user is assumed to have | 416 // This function uses Mac OS conventions. The super user is assumed to have |
| 417 // uid 0, and the administrator group is assumed to be named "admin". | 417 // uid 0, and the administrator group is assumed to be named "admin". |
| 418 // Testing that |path|, and every parent directory including the root of | 418 // Testing that |path|, and every parent directory including the root of |
| 419 // the filesystem, are owned by the superuser, controlled by the group | 419 // the filesystem, are owned by the superuser, controlled by the group |
| 420 // "admin", are not writable by all users, and contain no symbolic links. | 420 // "admin", are not writable by all users, and contain no symbolic links. |
| 421 // Will return false if |path| does not exist. | 421 // Will return false if |path| does not exist. |
| 422 BASE_EXPORT bool VerifyPathControlledByAdmin(const base::FilePath& path); | 422 BASE_EXPORT bool VerifyPathControlledByAdmin(const base::FilePath& path); |
| 423 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 423 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 424 | 424 |
| 425 // Returns the maximum length of path component on the volume containing |
| 426 // the directory |path|, in the number of FilePath::CharType, or -1 on failure. |
| 427 BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path); |
| 428 |
| 425 // A class to handle auto-closing of FILE*'s. | 429 // A class to handle auto-closing of FILE*'s. |
| 426 class ScopedFILEClose { | 430 class ScopedFILEClose { |
| 427 public: | 431 public: |
| 428 inline void operator()(FILE* x) const { | 432 inline void operator()(FILE* x) const { |
| 429 if (x) { | 433 if (x) { |
| 430 fclose(x); | 434 fclose(x); |
| 431 } | 435 } |
| 432 } | 436 } |
| 433 }; | 437 }; |
| 434 | 438 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 635 |
| 632 // Attempts determine the FileSystemType for |path|. | 636 // Attempts determine the FileSystemType for |path|. |
| 633 // Returns false if |path| doesn't exist. | 637 // Returns false if |path| doesn't exist. |
| 634 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, | 638 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, |
| 635 FileSystemType* type); | 639 FileSystemType* type); |
| 636 #endif | 640 #endif |
| 637 | 641 |
| 638 } // namespace file_util | 642 } // namespace file_util |
| 639 | 643 |
| 640 #endif // BASE_FILE_UTIL_H_ | 644 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |