summaryrefslogtreecommitdiffstats
path: root/base/file_util.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-23 20:20:10 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-23 20:20:10 +0000
commit7e1fde6a79fbc323f22a132dba6777dcd3464218 (patch)
treef644dd3ef1d3107bffda58c4da2fa2c331aa5e2e /base/file_util.cc
parentfe5956cb0e0529312c57603b41d4894c82c27b23 (diff)
downloadchromium_src-7e1fde6a79fbc323f22a132dba6777dcd3464218.zip
chromium_src-7e1fde6a79fbc323f22a132dba6777dcd3464218.tar.gz
chromium_src-7e1fde6a79fbc323f22a132dba6777dcd3464218.tar.bz2
file_util minor cleanup:
* add POSIX version of IsPathWritable * convert IsPathWritable to FilePath * convert CreateNewTempDirectory to FilePath * fix a bug where recursive delete errors weren't being handled in POSIX Review URL: http://codereview.chromium.org/16241 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.cc')
-rw-r--r--base/file_util.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index 1cf22b7..fe33c32 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -335,6 +335,19 @@ bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
bool CreateDirectory(const std::wstring& full_path) {
return CreateDirectory(FilePath::FromWStringHack(full_path));
}
+bool CreateNewTempDirectory(const std::wstring& prefix,
+ std::wstring* new_temp_path) {
+#if defined(OS_WIN)
+ FilePath::StringType dir_prefix(prefix);
+#elif defined(OS_POSIX)
+ FilePath::StringType dir_prefix = WideToUTF8(prefix);
+#endif
+ FilePath temp_path;
+ if (!CreateNewTempDirectory(dir_prefix, &temp_path))
+ return false;
+ *new_temp_path = temp_path.ToWStringHack();
+ return true;
+}
bool CreateTemporaryFileName(std::wstring* temp_file) {
FilePath temp_file_path;
if (!CreateTemporaryFileName(&temp_file_path))
@@ -390,6 +403,9 @@ FILE* OpenFile(const std::wstring& filename, const char* mode) {
bool PathExists(const std::wstring& path) {
return PathExists(FilePath::FromWStringHack(path));
}
+bool PathIsWritable(const std::wstring& path) {
+ return PathIsWritable(FilePath::FromWStringHack(path));
+}
bool SetCurrentDirectory(const std::wstring& directory) {
return SetCurrentDirectory(FilePath::FromWStringHack(directory));
}