Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: base/files/file_util.h

Issue 2086103002: Add base::ExecutableExistsInPath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't leak base::Environment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/files/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 #endif 30 #endif
31 31
32 #if defined(OS_POSIX) 32 #if defined(OS_POSIX)
33 #include "base/file_descriptor_posix.h" 33 #include "base/file_descriptor_posix.h"
34 #include "base/logging.h" 34 #include "base/logging.h"
35 #include "base/posix/eintr_wrapper.h" 35 #include "base/posix/eintr_wrapper.h"
36 #endif 36 #endif
37 37
38 namespace base { 38 namespace base {
39 39
40 class Environment;
40 class Time; 41 class Time;
41 42
42 //----------------------------------------------------------------------------- 43 //-----------------------------------------------------------------------------
43 // Functions that involve filesystem access or modification: 44 // Functions that involve filesystem access or modification:
44 45
45 // Returns an absolute version of a relative path. Returns an empty path on 46 // Returns an absolute version of a relative path. Returns an empty path on
46 // error. On POSIX, this function fails if the path does not exist. This 47 // error. On POSIX, this function fails if the path does not exist. This
47 // function can result in I/O so it can be slow. 48 // function can result in I/O so it can be slow.
48 BASE_EXPORT FilePath MakeAbsoluteFilePath(const FilePath& input); 49 BASE_EXPORT FilePath MakeAbsoluteFilePath(const FilePath& input);
49 50
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 }; 193 };
193 194
194 // Reads the permission of the given |path|, storing the file permission 195 // 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 196 // bits in |mode|. If |path| is symbolic link, |mode| is the permission of
196 // a file which the symlink points to. 197 // a file which the symlink points to.
197 BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode); 198 BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode);
198 // Sets the permission of the given |path|. If |path| is symbolic link, sets 199 // Sets the permission of the given |path|. If |path| is symbolic link, sets
199 // the permission of a file which the symlink points to. 200 // the permission of a file which the symlink points to.
200 BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode); 201 BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode);
201 202
203 // Returns true iff |executable| can be found in any directory specified by the
204 // environment variable in |env|.
205 BASE_EXPORT bool ExecutableExistsInPath(Environment* env,
206 const FilePath::StringType& executable);
207
202 #endif // OS_POSIX 208 #endif // OS_POSIX
203 209
204 // Returns true if the given directory is empty 210 // Returns true if the given directory is empty
205 BASE_EXPORT bool IsDirectoryEmpty(const FilePath& dir_path); 211 BASE_EXPORT bool IsDirectoryEmpty(const FilePath& dir_path);
206 212
207 // Get the temporary directory provided by the system. 213 // Get the temporary directory provided by the system.
208 // 214 //
209 // WARNING: In general, you should use CreateTemporaryFile variants below 215 // WARNING: In general, you should use CreateTemporaryFile variants below
210 // instead of this function. Those variants will ensure that the proper 216 // 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 217 // 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
435 // This function simulates Move(), but unlike Move() it works across volumes. 441 // This function simulates Move(), but unlike Move() it works across volumes.
436 // This function is not transactional. 442 // This function is not transactional.
437 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 443 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
438 const FilePath& to_path); 444 const FilePath& to_path);
439 #endif // defined(OS_WIN) 445 #endif // defined(OS_WIN)
440 446
441 } // namespace internal 447 } // namespace internal
442 } // namespace base 448 } // namespace base
443 449
444 #endif // BASE_FILES_FILE_UTIL_H_ 450 #endif // BASE_FILES_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698