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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 #if defined(OS_MACOSX) && !defined(OS_IOS) | 449 #if defined(OS_MACOSX) && !defined(OS_IOS) |
450 // Is |path| writable only by a user with administrator privileges? | 450 // Is |path| writable only by a user with administrator privileges? |
451 // This function uses Mac OS conventions. The super user is assumed to have | 451 // This function uses Mac OS conventions. The super user is assumed to have |
452 // uid 0, and the administrator group is assumed to be named "admin". | 452 // uid 0, and the administrator group is assumed to be named "admin". |
453 // Testing that |path|, and every parent directory including the root of | 453 // Testing that |path|, and every parent directory including the root of |
454 // the filesystem, are owned by the superuser, controlled by the group | 454 // the filesystem, are owned by the superuser, controlled by the group |
455 // "admin", are not writable by all users, and contain no symbolic links. | 455 // "admin", are not writable by all users, and contain no symbolic links. |
456 // Will return false if |path| does not exist. | 456 // Will return false if |path| does not exist. |
457 BASE_EXPORT bool VerifyPathControlledByAdmin(const FilePath& path); | 457 BASE_EXPORT bool VerifyPathControlledByAdmin(const FilePath& path); |
458 #endif // defined(OS_MACOSX) | 458 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
459 | 459 |
460 // A class to handle auto-closing of FILE*'s. | 460 // A class to handle auto-closing of FILE*'s. |
461 class ScopedFILEClose { | 461 class ScopedFILEClose { |
462 public: | 462 public: |
463 inline void operator()(FILE* x) const { | 463 inline void operator()(FILE* x) const { |
464 if (x) { | 464 if (x) { |
465 fclose(x); | 465 fclose(x); |
466 } | 466 } |
467 } | 467 } |
468 }; | 468 }; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 }; | 665 }; |
666 | 666 |
667 // Attempts determine the FileSystemType for |path|. | 667 // Attempts determine the FileSystemType for |path|. |
668 // Returns false if |path| doesn't exist. | 668 // Returns false if |path| doesn't exist. |
669 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 669 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
670 #endif | 670 #endif |
671 | 671 |
672 } // namespace file_util | 672 } // namespace file_util |
673 | 673 |
674 #endif // BASE_FILE_UTIL_H_ | 674 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |