summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 17:49:05 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 17:49:05 +0000
commit63597e4ebc117bb561b93f4d775d787120e6728a (patch)
treea4825625ef2ff06b339e56a30fa5ae80aea29160 /base
parentc48abb01ae7e295e283f190bd05270e835b8d37f (diff)
downloadchromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.zip
chromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.tar.gz
chromium_src-63597e4ebc117bb561b93f4d775d787120e6728a.tar.bz2
Deprecate most of the remaining wstring file_util functions.
These still exist on Windows due to being used by the installer, but by moving them into the Windows-only block we prevent them from being used in new code. (I am already finding new code using some of these! I am glad to be rid of them.) BUG=24672 Review URL: http://codereview.chromium.org/2850042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util_deprecated.h42
-rw-r--r--base/file_util_unittest.cc6
2 files changed, 30 insertions, 18 deletions
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h
index a5b7899..dd2ffc8 100644
--- a/base/file_util_deprecated.h
+++ b/base/file_util_deprecated.h
@@ -15,29 +15,17 @@
#include "build/build_config.h"
-namespace file_util {
-
-// Use FilePath::Extension instead.
-FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
-std::wstring GetFileExtensionFromPath(const std::wstring& path);
-bool AbsolutePath(std::wstring* path);
-
-// Use FilePath::InsertBeforeExtension.
-void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
+namespace file_util {
-bool Delete(const std::wstring& path, bool recursive);
-bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
- bool recursive);
-bool ReadFileToString(const std::wstring& path, std::string* contents);
+// Use the FilePath versions instead.
FILE* OpenFile(const std::string& filename, const char* mode);
FILE* OpenFile(const std::wstring& filename, const char* mode);
-int ReadFile(const std::wstring& filename, char* data, int size);
-int WriteFile(const std::wstring& filename, const char* data, int size);
-// Functions successfully deprecated on non-Windows, but Win-specific
-// callers remain.
+// We've successfully deprecated most of these functions on non-Windows
+// platforms.
#if defined(OS_WIN)
+
// Use FilePath::DirName instead.
void UpOneDirectory(std::wstring* dir);
// Use FilePath::DirName instead.
@@ -60,7 +48,25 @@ std::wstring GetDirectoryFromPath(const std::wstring& path);
// Appends new_ending to path, adding a separator between the two if necessary.
void AppendToPath(std::wstring* path, const std::wstring& new_ending);
-#endif
+
+// Use FilePath::Extension instead.
+FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
+std::wstring GetFileExtensionFromPath(const std::wstring& path);
+
+bool AbsolutePath(std::wstring* path);
+
+// Use FilePath::InsertBeforeExtension.
+void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
+
+// Use version that takes a FilePath.
+bool Delete(const std::wstring& path, bool recursive);
+bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
+ bool recursive);
+bool ReadFileToString(const std::wstring& path, std::string* contents);
+int ReadFile(const std::wstring& filename, char* data, int size);
+int WriteFile(const std::wstring& filename, const char* data, int size);
+
+#endif // OS_WIN
}
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index fd54963..7acf00c 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -292,6 +292,8 @@ static const struct InsertBeforeExtensionCase {
#endif
};
+#if defined(OS_WIN)
+// This function has been deprecated on non-Windows.
TEST_F(FileUtilTest, InsertBeforeExtensionTest) {
for (unsigned int i = 0; i < arraysize(kInsertBeforeExtension); ++i) {
FilePath path(kInsertBeforeExtension[i].path);
@@ -299,6 +301,7 @@ TEST_F(FileUtilTest, InsertBeforeExtensionTest) {
EXPECT_EQ(kInsertBeforeExtension[i].result, path.value());
}
}
+#endif
static const struct filename_case {
const wchar_t* path;
@@ -363,6 +366,8 @@ static const struct extension_case {
#endif
};
+#if defined(OS_WIN)
+// This function has been deprecated on non-Windows.
TEST_F(FileUtilTest, GetFileExtensionFromPath) {
for (unsigned int i = 0; i < arraysize(extension_cases); ++i) {
const extension_case& ext = extension_cases[i];
@@ -370,6 +375,7 @@ TEST_F(FileUtilTest, GetFileExtensionFromPath) {
EXPECT_EQ(ext.extension, fext);
}
}
+#endif
// Test finding the directory component of a path
static const struct dir_case {