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

Unified Diff: base/file_util_posix.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.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 f438253761dd98ef220c40f65adf306b4bbcdf6e..c368534b2715d16bd6b1e9b365f211a17d242514 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -314,6 +314,19 @@ bool PathExists(const FilePath& path) {
return access(path.value().c_str(), F_OK) == 0;
}
+bool PathIsWritable(const FilePath& path) {
+ ThreadRestrictions::AssertIOAllowed();
+ return access(path.value().c_str(), W_OK) == 0;
+}
+
+bool DirectoryExists(const FilePath& path) {
+ ThreadRestrictions::AssertIOAllowed();
+ stat_wrapper_t file_info;
+ if (CallStat(path.value().c_str(), &file_info) == 0)
+ return S_ISDIR(file_info.st_mode);
+ return false;
+}
+
} // namespace base
// -----------------------------------------------------------------------------
@@ -323,25 +336,13 @@ namespace file_util {
using base::stat_wrapper_t;
using base::CallStat;
using base::CallLstat;
+using base::DirectoryExists;
using base::FileEnumerator;
using base::FilePath;
using base::MakeAbsoluteFilePath;
using base::RealPath;
using base::VerifySpecificPathControlledByUser;
-bool PathIsWritable(const FilePath& path) {
- base::ThreadRestrictions::AssertIOAllowed();
- return access(path.value().c_str(), W_OK) == 0;
-}
-
-bool DirectoryExists(const FilePath& path) {
- base::ThreadRestrictions::AssertIOAllowed();
- stat_wrapper_t file_info;
- if (CallStat(path.value().c_str(), &file_info) == 0)
- return S_ISDIR(file_info.st_mode);
- return false;
-}
-
bool ReadFromFD(int fd, char* buffer, size_t bytes) {
size_t total_read = 0;
while (total_read < bytes) {
« 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