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-01 19:41:02 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 19:41:02 +0000
commit918efbf64de58c82ffa3cd8799d9ad822811a37a (patch)
tree5ceffb5e1576177d75f1aa8546bcae074df63c1e /base/file_util_posix.cc
parente07f44f6b208541c9602bb9cc5f311612aaab64a (diff)
downloadchromium_src-918efbf64de58c82ffa3cd8799d9ad822811a37a.zip
chromium_src-918efbf64de58c82ffa3cd8799d9ad822811a37a.tar.gz
chromium_src-918efbf64de58c82ffa3cd8799d9ad822811a37a.tar.bz2
Move file_util::Delete to the base namespace
BUG= Review URL: https://codereview.chromium.org/16950028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc61
1 files changed, 34 insertions, 27 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 77e080a..afb34b4 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -58,24 +58,8 @@
#include "base/chromeos/chromeos_version.h"
#endif
-using base::FileEnumerator;
-using base::FilePath;
-using base::MakeAbsoluteFilePath;
-
namespace base {
-FilePath MakeAbsoluteFilePath(const FilePath& input) {
- base::ThreadRestrictions::AssertIOAllowed();
- char full_path[PATH_MAX];
- if (realpath(input.value().c_str(), full_path) == NULL)
- return FilePath();
- return FilePath(full_path);
-}
-
-} // namespace base
-
-namespace file_util {
-
namespace {
#if defined(OS_BSD) || defined(OS_MACOSX)
@@ -152,16 +136,12 @@ bool VerifySpecificPathControlledByUser(const FilePath& path,
} // namespace
-static std::string TempFileName() {
-#if defined(OS_MACOSX)
- return base::StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID());
-#endif
-
-#if defined(GOOGLE_CHROME_BUILD)
- return std::string(".com.google.Chrome.XXXXXX");
-#else
- return std::string(".org.chromium.Chromium.XXXXXX");
-#endif
+FilePath MakeAbsoluteFilePath(const FilePath& input) {
+ ThreadRestrictions::AssertIOAllowed();
+ char full_path[PATH_MAX];
+ if (realpath(input.value().c_str(), full_path) == NULL)
+ return FilePath();
+ return FilePath(full_path);
}
// TODO(erikkay): The Windows version of this accepts paths like "foo/bar/*"
@@ -169,7 +149,7 @@ static std::string TempFileName() {
// that functionality. If not, remove from file_util_win.cc, otherwise add it
// here.
bool Delete(const FilePath& path, bool recursive) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
const char* path_str = path.value().c_str();
stat_wrapper_t file_info;
int test = CallLstat(path_str, &file_info);
@@ -205,6 +185,33 @@ bool Delete(const FilePath& path, bool recursive) {
return success;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::stat_wrapper_t;
+using base::CallStat;
+using base::CallLstat;
+using base::FileEnumerator;
+using base::FilePath;
+using base::MakeAbsoluteFilePath;
+using base::RealPath;
+using base::VerifySpecificPathControlledByUser;
+
+static std::string TempFileName() {
+#if defined(OS_MACOSX)
+ return base::StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID());
+#endif
+
+#if defined(GOOGLE_CHROME_BUILD)
+ return std::string(".com.google.Chrome.XXXXXX");
+#else
+ return std::string(".org.chromium.Chromium.XXXXXX");
+#endif
+}
+
bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) {
base::ThreadRestrictions::AssertIOAllowed();
// Windows compatibility: if to_path exists, from_path and to_path