Chromium Code Reviews| 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_FILES_FILE_UTIL_H_ | 8 #ifndef BASE_FILES_FILE_UTIL_H_ |
| 9 #define BASE_FILES_FILE_UTIL_H_ | 9 #define BASE_FILES_FILE_UTIL_H_ |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 // Reads the permission of the given |path|, storing the file permission | 194 // Reads the permission of the given |path|, storing the file permission |
| 195 // bits in |mode|. If |path| is symbolic link, |mode| is the permission of | 195 // bits in |mode|. If |path| is symbolic link, |mode| is the permission of |
| 196 // a file which the symlink points to. | 196 // a file which the symlink points to. |
| 197 BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode); | 197 BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode); |
| 198 // Sets the permission of the given |path|. If |path| is symbolic link, sets | 198 // Sets the permission of the given |path|. If |path| is symbolic link, sets |
| 199 // the permission of a file which the symlink points to. | 199 // the permission of a file which the symlink points to. |
| 200 BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode); | 200 BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode); |
| 201 | 201 |
| 202 // Returns true iff |executable| can be found in any directory specified by the | |
| 203 // $PATH environment variable. | |
| 204 BASE_EXPORT bool ExecutableExistsInPath(const char* executable); | |
|
Lei Zhang
2016/06/21 21:31:21
Use a StringPiece
Tom (Use chromium acct)
2016/06/22 16:57:55
Used FilePath::StringType instead, as this is what
Lei Zhang
2016/06/23 19:17:05
Ya, that's fine.
| |
| 205 | |
| 202 #endif // OS_POSIX | 206 #endif // OS_POSIX |
| 203 | 207 |
| 204 // Returns true if the given directory is empty | 208 // Returns true if the given directory is empty |
| 205 BASE_EXPORT bool IsDirectoryEmpty(const FilePath& dir_path); | 209 BASE_EXPORT bool IsDirectoryEmpty(const FilePath& dir_path); |
| 206 | 210 |
| 207 // Get the temporary directory provided by the system. | 211 // Get the temporary directory provided by the system. |
| 208 // | 212 // |
| 209 // WARNING: In general, you should use CreateTemporaryFile variants below | 213 // WARNING: In general, you should use CreateTemporaryFile variants below |
| 210 // instead of this function. Those variants will ensure that the proper | 214 // instead of this function. Those variants will ensure that the proper |
| 211 // permissions are set so that other users on the system can't edit them while | 215 // permissions are set so that other users on the system can't edit them while |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 // This function simulates Move(), but unlike Move() it works across volumes. | 439 // This function simulates Move(), but unlike Move() it works across volumes. |
| 436 // This function is not transactional. | 440 // This function is not transactional. |
| 437 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 441 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 438 const FilePath& to_path); | 442 const FilePath& to_path); |
| 439 #endif // defined(OS_WIN) | 443 #endif // defined(OS_WIN) |
| 440 | 444 |
| 441 } // namespace internal | 445 } // namespace internal |
| 442 } // namespace base | 446 } // namespace base |
| 443 | 447 |
| 444 #endif // BASE_FILES_FILE_UTIL_H_ | 448 #endif // BASE_FILES_FILE_UTIL_H_ |
| OLD | NEW |