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

Unified Diff: base/file_util.h

Issue 18332014: Move Copy* into the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/file_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.h
diff --git a/base/file_util.h b/base/file_util.h
index bdef48a363f194c89abcbff7b00403d90437387c..321070fd84a1b343410b0790a89fe1430959cb7e 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -87,11 +87,6 @@ BASE_EXPORT bool DeleteAfterReboot(const FilePath& path);
// This function fails if either path contains traversal components ('..').
BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path);
-// Same as Move but allows paths with traversal components.
-// Use only with extreme care.
-BASE_EXPORT bool MoveUnsafe(const FilePath& from_path,
- const FilePath& to_path);
-
// Renames file |from_path| to |to_path|. Both paths must be on the same
// volume, or the function will fail. Destination file will be created
// if it doesn't exist. Prefer this function over Move when dealing with
@@ -102,21 +97,9 @@ BASE_EXPORT bool ReplaceFile(const FilePath& from_path,
const FilePath& to_path,
PlatformFileError* error);
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
// Copies a single file. Use CopyDirectory to copy directories.
// This function fails if either path contains traversal components ('..').
-BASE_EXPORT bool CopyFile(const base::FilePath& from_path,
- const base::FilePath& to_path);
-
-// Same as CopyFile but allows paths with traversal components.
-// Use only with extreme care.
-BASE_EXPORT bool CopyFileUnsafe(const base::FilePath& from_path,
- const base::FilePath& to_path);
+BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path);
// Copies the given path, and optionally all subdirectories and their contents
// as well.
@@ -125,10 +108,16 @@ BASE_EXPORT bool CopyFileUnsafe(const base::FilePath& from_path,
// if successful, false otherwise. Wildcards on the names are not supported.
//
// If you only need to copy a file use CopyFile, it's faster.
-BASE_EXPORT bool CopyDirectory(const base::FilePath& from_path,
- const base::FilePath& to_path,
+BASE_EXPORT bool CopyDirectory(const FilePath& from_path,
+ const FilePath& to_path,
bool recursive);
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
// Returns true if the given path exists on the local filesystem,
// false otherwise.
BASE_EXPORT bool PathExists(const base::FilePath& path);
@@ -202,15 +191,6 @@ BASE_EXPORT bool SetPosixFilePermissions(const base::FilePath& path,
int mode);
#endif // defined(OS_POSIX)
-#if defined(OS_WIN)
-// Copy from_path to to_path recursively and then delete from_path recursively.
-// Returns true if all operations succeed.
-// This function simulates Move(), but unlike Move() it works across volumes.
-// This fuction is not transactional.
-BASE_EXPORT bool CopyAndDeleteDirectory(const base::FilePath& from_path,
- const base::FilePath& to_path);
-#endif // defined(OS_WIN)
-
// Return true if the given directory is empty
BASE_EXPORT bool IsDirectoryEmpty(const base::FilePath& dir_path);
@@ -454,4 +434,31 @@ BASE_EXPORT bool GetFileSystemType(const base::FilePath& path,
} // namespace file_util
+// Internal --------------------------------------------------------------------
+
+namespace base {
+namespace internal {
+
+// Same as Move but allows paths with traversal components.
+// Use only with extreme care.
+BASE_EXPORT bool MoveUnsafe(const FilePath& from_path,
+ const FilePath& to_path);
+
+// Same as CopyFile but allows paths with traversal components.
+// Use only with extreme care.
+BASE_EXPORT bool CopyFileUnsafe(const FilePath& from_path,
+ const FilePath& to_path);
+
+#if defined(OS_WIN)
+// Copy from_path to to_path recursively and then delete from_path recursively.
+// Returns true if all operations succeed.
+// This function simulates Move(), but unlike Move() it works across volumes.
+// This fuction is not transactional.
+BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
+ const FilePath& to_path);
+#endif // defined(OS_WIN)
+
+} // namespace internal
+} // namespace base
+
#endif // BASE_FILE_UTIL_H_
« no previous file with comments | « no previous file | base/file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698