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

Unified Diff: base/file_util_win.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « base/file_util_unittest.cc ('k') | base/files/file_path_watcher_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 90d8fca396e9950ede12cd94284f4726cbbc5ca1..95843d9ea234a563962ed49d4104e093ee625e85 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -176,7 +176,7 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path,
return ShellCopy(from_path, to_path, true);
// The following code assumes that from path is a directory.
- DCHECK(file_util::DirectoryExists(from_path));
+ DCHECK(DirectoryExists(from_path));
// Instead of creating a new directory, we copy the old one to include the
// security information of the folder as part of the copy.
@@ -198,17 +198,8 @@ bool PathExists(const FilePath& path) {
return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES);
}
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
-using base::FilePath;
-using base::kFileShareAll;
-
bool PathIsWritable(const FilePath& path) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
HANDLE dir =
CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
@@ -221,13 +212,23 @@ bool PathIsWritable(const FilePath& path) {
}
bool DirectoryExists(const FilePath& path) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
DWORD fileattr = GetFileAttributes(path.value().c_str());
if (fileattr != INVALID_FILE_ATTRIBUTES)
return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
return false;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::DirectoryExists;
+using base::FilePath;
+using base::kFileShareAll;
+
bool GetTempDir(FilePath* path) {
base::ThreadRestrictions::AssertIOAllowed();
@@ -710,7 +711,7 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) {
bool ret = false;
DWORD last_error = ::GetLastError();
- if (file_util::DirectoryExists(from_path)) {
+ if (DirectoryExists(from_path)) {
// MoveFileEx fails if moving directory across volumes. We will simulate
// the move by using Copy and Delete. Ideally we could check whether
// from_path and to_path are indeed in different volumes.
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/files/file_path_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698