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

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: Revert change to CopyFileUnsafe 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') | 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_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 keeps the metadata on OSX and on Windows. The read only bit on
102 // Windows is not kept.
100 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path); 103 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path);
101 104
102 // Copies the given path, and optionally all subdirectories and their contents 105 // Copies the given path, and optionally all subdirectories and their contents
103 // as well. 106 // as well.
104 // 107 //
105 // If there are files existing under to_path, always overwrite. Returns true 108 // If there are files existing under to_path, always overwrite. Returns true
106 // if successful, false otherwise. Wildcards on the names are not supported. 109 // if successful, false otherwise. Wildcards on the names are not supported.
107 // 110 //
111 // This function calls into CopyFile() so the same behavior w.r.t. metadata
112 // applies.
113 //
108 // If you only need to copy a file use CopyFile, it's faster. 114 // If you only need to copy a file use CopyFile, it's faster.
109 BASE_EXPORT bool CopyDirectory(const FilePath& from_path, 115 BASE_EXPORT bool CopyDirectory(const FilePath& from_path,
110 const FilePath& to_path, 116 const FilePath& to_path,
111 bool recursive); 117 bool recursive);
112 118
113 // Returns true if the given path exists on the local filesystem, 119 // Returns true if the given path exists on the local filesystem,
114 // false otherwise. 120 // false otherwise.
115 BASE_EXPORT bool PathExists(const FilePath& path); 121 BASE_EXPORT bool PathExists(const FilePath& path);
116 122
117 // Returns true if the given path is writable by the user, false otherwise. 123 // 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. 462 // This function simulates Move(), but unlike Move() it works across volumes.
457 // This function is not transactional. 463 // This function is not transactional.
458 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 464 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
459 const FilePath& to_path); 465 const FilePath& to_path);
460 #endif // defined(OS_WIN) 466 #endif // defined(OS_WIN)
461 467
462 } // namespace internal 468 } // namespace internal
463 } // namespace base 469 } // namespace base
464 470
465 #endif // BASE_FILE_UTIL_H_ 471 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698