Deprecate file_util::AppendToPath() on non-Windows.

We still have ~150 callers to AppendToPath in our code, but most of
them are in the installer and I'm reluctant to fiddle with that code
without having an easy way to test it.

BUG=24672

Review URL: http://codereview.chromium.org/654013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40120 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 1840cfcf0da037741761abe2c04f73c354dff17a
diff --git a/base/file_util.cc b/base/file_util.cc
index e0e6772..b10cd0b 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -331,16 +331,21 @@
   *path_str = path.ToWStringHack();
   return true;
 }
+
+#if defined(OS_WIN)
+// This function is deprecated; see file_util_deprecated.h for details.
 void AppendToPath(std::wstring* path, const std::wstring& new_ending) {
   if (!path) {
     NOTREACHED();
     return;  // Don't crash in this function in release builds.
   }
 
-  if (!EndsWithSeparator(path))
+  if (!EndsWithSeparator(*path))
     path->push_back(FilePath::kSeparators[0]);
   path->append(new_ending);
 }
+#endif
+
 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
                    bool recursive) {
   return CopyDirectory(FilePath::FromWStringHack(from_path),
@@ -350,9 +355,6 @@
 bool Delete(const std::wstring& path, bool recursive) {
   return Delete(FilePath::FromWStringHack(path), recursive);
 }
-bool EndsWithSeparator(std::wstring* path) {
-  return EndsWithSeparator(FilePath::FromWStringHack(*path));
-}
 bool EndsWithSeparator(const std::wstring& path) {
   return EndsWithSeparator(FilePath::FromWStringHack(path));
 }
diff --git a/base/file_util.h b/base/file_util.h
index fbde3e7..4d6077e 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -49,9 +49,6 @@
 // exists. Returns true if |path| is an existing directory, false otherwise.
 bool EnsureEndsWithSeparator(FilePath* path);
 
-// Appends new_ending to path, adding a separator between the two if necessary.
-void AppendToPath(std::wstring* path, const std::wstring& new_ending);
-
 // Convert provided relative path into an absolute path.  Returns false on
 // error. On POSIX, this function fails if the path does not exist.
 bool AbsolutePath(FilePath* path);
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h
index 05fd514..59f8d82 100644
--- a/base/file_util_deprecated.h
+++ b/base/file_util_deprecated.h
@@ -54,7 +54,8 @@
 int WriteFile(const std::wstring& filename, const char* data, int size);
 bool GetCurrentDirectory(std::wstring* path);
 
-// Successfully deprecated on non-Windows, but Win-specific callers remain.
+// Functions successfully deprecated on non-Windows, but Win-specific
+// callers remain.
 #if defined(OS_WIN)
 // Returns the directory component of a path, without the trailing
 // path separator, or an empty string on error. The function does not
@@ -67,6 +68,9 @@
 // path == "C:\Windows\system32",  returns "C:\Windows"
 // Deprecated. Use FilePath's DirName() instead.
 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
 
 }
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index ae6560d..fa92737 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -145,6 +145,8 @@
 #endif
 };
 
+#if defined(OS_WIN)
+// This function is deprecated, but still used on Windows.
 TEST_F(FileUtilTest, AppendToPath) {
   for (unsigned int i = 0; i < arraysize(append_cases); ++i) {
     const append_case& value = append_cases[i];
@@ -157,6 +159,8 @@
   file_util::AppendToPath(NULL, L"path");  // asserts in debug mode
 #endif
 }
+#endif  // defined(OS_WIN)
+
 
 static const struct InsertBeforeExtensionCase {
   const FilePath::CharType* path;