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


CrOS-Libchrome-Original-Commit: 7e1fde6a79fbc323f22a132dba6777dcd3464218
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 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 @@
 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));
 }