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

Unified Diff: base/file_util_posix.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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.cc ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index f566efb1a542fba67a997fd4a56c696f976deea5..f3a7553148721a34ca190c86e5fda45646f9a5b7 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -623,6 +623,22 @@ bool CreateDirectoryAndGetError(const FilePath& full_path,
return true;
}
+bool NormalizeFilePath(const FilePath& path, FilePath* normalized_path) {
+ FilePath real_path_result;
+ if (!RealPath(path, &real_path_result))
+ return false;
+
+ // To be consistant with windows, fail if |real_path_result| is a
+ // directory.
+ stat_wrapper_t file_info;
+ if (CallStat(real_path_result.value().c_str(), &file_info) != 0 ||
+ S_ISDIR(file_info.st_mode))
+ return false;
+
+ *normalized_path = real_path_result;
+ return true;
+}
+
} // namespace base
// -----------------------------------------------------------------------------
@@ -637,7 +653,6 @@ using base::DirectoryExists;
using base::FileEnumerator;
using base::FilePath;
using base::MakeAbsoluteFilePath;
-using base::RealPath;
using base::VerifySpecificPathControlledByUser;
base::FilePath MakeUniqueDirectory(const base::FilePath& path) {
@@ -804,22 +819,6 @@ bool SetCurrentDirectory(const FilePath& path) {
return !ret;
}
-bool NormalizeFilePath(const FilePath& path, FilePath* normalized_path) {
- FilePath real_path_result;
- if (!RealPath(path, &real_path_result))
- return false;
-
- // To be consistant with windows, fail if |real_path_result| is a
- // directory.
- stat_wrapper_t file_info;
- if (CallStat(real_path_result.value().c_str(), &file_info) != 0 ||
- S_ISDIR(file_info.st_mode))
- return false;
-
- *normalized_path = real_path_result;
- return true;
-}
-
bool VerifyPathControlledByUser(const FilePath& base,
const FilePath& path,
uid_t owner_uid,
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698