summaryrefslogtreecommitdiffstats
path: root/base/file_util_posix.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-15 20:18:09 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-15 20:18:09 +0000
commitdcd16611096dcc5e7651763ff888135e0fb305fc (patch)
treefe1f69c236a92bd701bad04a6ccc1d30c08c6217 /base/file_util_posix.cc
parent6dd1c54f48283e9c61b097b59feecf8d221e123b (diff)
downloadchromium_src-dcd16611096dcc5e7651763ff888135e0fb305fc.zip
chromium_src-dcd16611096dcc5e7651763ff888135e0fb305fc.tar.gz
chromium_src-dcd16611096dcc5e7651763ff888135e0fb305fc.tar.bz2
Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace.
TBR=sky Review URL: https://codereview.chromium.org/19052005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index f438253..c368534 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) {