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

Side by Side Diff: base/file_util.h

Issue 141273010: Make CopyDirectory() not copy the read only bit on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | base/file_util_win.cc » ('J')
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_FILE_UTIL_H_ 8 #ifndef BASE_FILE_UTIL_H_
9 #define BASE_FILE_UTIL_H_ 9 #define BASE_FILE_UTIL_H_
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // if it doesn't exist. Prefer this function over Move when dealing with 90 // if it doesn't exist. Prefer this function over Move when dealing with
91 // temporary files. On Windows it preserves attributes of the target file. 91 // temporary files. On Windows it preserves attributes of the target file.
92 // Returns true on success, leaving *error unchanged. 92 // Returns true on success, leaving *error unchanged.
93 // Returns false on failure and sets *error appropriately, if it is non-NULL. 93 // Returns false on failure and sets *error appropriately, if it is non-NULL.
94 BASE_EXPORT bool ReplaceFile(const FilePath& from_path, 94 BASE_EXPORT bool ReplaceFile(const FilePath& from_path,
95 const FilePath& to_path, 95 const FilePath& to_path,
96 File::Error* error); 96 File::Error* error);
97 97
98 // Copies a single file. Use CopyDirectory to copy directories. 98 // Copies a single file. Use CopyDirectory to copy directories.
99 // This function fails if either path contains traversal components ('..'). 99 // This function fails if either path contains traversal components ('..').
100 //
101 // This function doesn't keep the metadata of from_path except on OSX.
100 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path); 102 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path);
101 103
102 // Copies the given path, and optionally all subdirectories and their contents 104 // Copies the given path, and optionally all subdirectories and their contents
103 // as well. 105 // as well.
104 // 106 //
105 // If there are files existing under to_path, always overwrite. Returns true 107 // If there are files existing under to_path, always overwrite. Returns true
106 // if successful, false otherwise. Wildcards on the names are not supported. 108 // if successful, false otherwise. Wildcards on the names are not supported.
107 // 109 //
110 // This function doesn't keep the metadata of from_path except on OSX.
111 //
108 // If you only need to copy a file use CopyFile, it's faster. 112 // If you only need to copy a file use CopyFile, it's faster.
109 BASE_EXPORT bool CopyDirectory(const FilePath& from_path, 113 BASE_EXPORT bool CopyDirectory(const FilePath& from_path,
110 const FilePath& to_path, 114 const FilePath& to_path,
111 bool recursive); 115 bool recursive);
112 116
113 // Returns true if the given path exists on the local filesystem, 117 // Returns true if the given path exists on the local filesystem,
114 // false otherwise. 118 // false otherwise.
115 BASE_EXPORT bool PathExists(const FilePath& path); 119 BASE_EXPORT bool PathExists(const FilePath& path);
116 120
117 // Returns true if the given path is writable by the user, false otherwise. 121 // Returns true if the given path is writable by the user, false otherwise.
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // This function simulates Move(), but unlike Move() it works across volumes. 460 // This function simulates Move(), but unlike Move() it works across volumes.
457 // This function is not transactional. 461 // This function is not transactional.
458 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 462 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
459 const FilePath& to_path); 463 const FilePath& to_path);
460 #endif // defined(OS_WIN) 464 #endif // defined(OS_WIN)
461 465
462 } // namespace internal 466 } // namespace internal
463 } // namespace base 467 } // namespace base
464 468
465 #endif // BASE_FILE_UTIL_H_ 469 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | base/file_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698