Skip to content

Commit

Permalink
Move PathExists to base namespace.
Browse files Browse the repository at this point in the history
BUG=
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/18286004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211147 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Jul 11, 2013
1 parent 8a25d54 commit 7567484
Show file tree
Hide file tree
Showing 361 changed files with 1,509 additions and 1,510 deletions.
2 changes: 1 addition & 1 deletion base/android/path_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TEST_F(PathUtilsTest, TestGetNativeLibraryDirectory) {
// the base tests shared object.
FilePath path;
GetNativeLibraryDirectory(&path);
EXPECT_TRUE(file_util::PathExists(path.Append(("libbase_unittests.so"))));
EXPECT_TRUE(base::PathExists(path.Append(("libbase_unittests.so"))));
}

} // namespace android
Expand Down
2 changes: 1 addition & 1 deletion base/base_paths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool PathProvider(int key, FilePath* result) {
cur = cur.Append(FILE_PATH_LITERAL("base"));
cur = cur.Append(FILE_PATH_LITERAL("test"));
cur = cur.Append(FILE_PATH_LITERAL("data"));
if (!file_util::PathExists(cur)) // We don't want to create this.
if (!base::PathExists(cur)) // We don't want to create this.
return false;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion base/base_paths_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool PathProviderMac(int key, base::FilePath* result) {
result);
#if defined(OS_IOS)
// On IOS, this directory does not exist unless it is created explicitly.
if (success && !file_util::PathExists(*result))
if (success && !base::PathExists(*result))
success = file_util::CreateDirectory(*result);
#endif // defined(OS_IOS)
return success;
Expand Down
2 changes: 1 addition & 1 deletion base/base_paths_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool PathProviderPosix(int key, FilePath* result) {
std::string cr_source_root;
if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) {
path = FilePath(cr_source_root);
if (file_util::PathExists(path)) {
if (base::PathExists(path)) {
*result = path;
return true;
} else {
Expand Down
8 changes: 4 additions & 4 deletions base/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ BASE_EXPORT bool CopyDirectory(const FilePath& from_path,
const FilePath& to_path,
bool recursive);

// Returns true if the given path exists on the local filesystem,
// false otherwise.
BASE_EXPORT bool PathExists(const FilePath& path);

} // 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);

// Returns true if the given path is writable by the user, false otherwise.
BASE_EXPORT bool PathIsWritable(const base::FilePath& path);

Expand Down
12 changes: 6 additions & 6 deletions base/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ bool CopyDirectory(const FilePath& from_path,

// This function does not properly handle destinations within the source
FilePath real_to_path = to_path;
if (file_util::PathExists(real_to_path)) {
if (PathExists(real_to_path)) {
real_to_path = MakeAbsoluteFilePath(real_to_path);
if (real_to_path.empty())
return false;
Expand Down Expand Up @@ -309,6 +309,11 @@ bool CopyDirectory(const FilePath& from_path,
return success;
}

bool PathExists(const FilePath& path) {
ThreadRestrictions::AssertIOAllowed();
return access(path.value().c_str(), F_OK) == 0;
}

} // namespace base

// -----------------------------------------------------------------------------
Expand All @@ -324,11 +329,6 @@ using base::MakeAbsoluteFilePath;
using base::RealPath;
using base::VerifySpecificPathControlledByUser;

bool PathExists(const FilePath& path) {
base::ThreadRestrictions::AssertIOAllowed();
return access(path.value().c_str(), F_OK) == 0;
}

bool PathIsWritable(const FilePath& path) {
base::ThreadRestrictions::AssertIOAllowed();
return access(path.value().c_str(), W_OK) == 0;
Expand Down
Loading

0 comments on commit 7567484

Please sign in to comment.