Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2268)

Unified Diff: base/file_util.h

Issue 12489: Remove file_util::kPathSeparator from posix. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_path.cc ('k') | base/file_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.h
===================================================================
--- base/file_util.h (revision 6039)
+++ base/file_util.h (working copy)
@@ -24,23 +24,31 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_path.h"
-class FilePath;
-
namespace file_util {
//-----------------------------------------------------------------------------
// Constants
+#if defined(OS_WIN)
+// The use of this constant is deprecated. Instead use file_util or FilePath
+// functions (Append, TrimTrailingSeparator, etc.), or use
+// FilePath::kSeparator[0].
extern const wchar_t kPathSeparator;
+#endif
-
//-----------------------------------------------------------------------------
// Functions that operate purely on a path string w/o touching the filesystem:
// Returns a vector of all of the components of the provided path.
+void PathComponents(const FilePath& path,
+ std::vector<FilePath::StringType>* components);
+#if defined(OS_WIN)
+// Deprecated temporary compatibility function.
void PathComponents(const std::wstring& path,
std::vector<std::wstring>* components);
+#endif
// Returns true if the given path ends with a path separator character.
bool EndsWithSeparator(const FilePath& path);
@@ -58,14 +66,18 @@
// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
// refer to a file.
// If 'dir' is a root directory, return without change.
+// Deprecated. Use FilePath::DirName instead.
void UpOneDirectory(std::wstring* dir);
// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
// refer to a file.
// If 'dir' is a root directory, the result becomes empty string.
+// Deprecated. Use FilePath::DirName instead.
void UpOneDirectoryOrEmpty(std::wstring* dir);
-// Strips the filename component from the end of 'path'.
+// Strips the filename component from the end of 'path'. If path ends with a
+// separator, then just drop the separator.
+// Deprecated. Use FilePath::DirName instead.
void TrimFilename(std::wstring* path);
// Returns the filename portion of 'path', without any leading \'s or /'s.
@@ -98,6 +110,9 @@
// Deprecated temporary compatibility function.
bool AbsolutePath(std::wstring* path);
+// TODO(port): create FilePath versions of these functions, and remove this
+// platform define.
+#if defined(OS_WIN)
// Inserts |suffix| after the file name portion of |path| but before the
// extension.
// Examples:
@@ -107,6 +122,12 @@
// path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)"
void InsertBeforeExtension(std::wstring* path, const std::wstring& suffix);
+// Replaces the extension of |file_name| with |extension|. If |file_name|
+// does not have an extension, them |extension| is added. If |extension| is
+// empty, then the extension is removed from |file_name|.
+void ReplaceExtension(std::wstring* file_name, const std::wstring& extension);
+#endif
+
// Replaces characters in 'file_name' that are illegal for file names with
// 'replace_char'. 'file_name' must not be a full or relative path, but just the
// file name component. Any leading or trailing whitespace in 'file_name' is
@@ -116,11 +137,6 @@
// 'replace_char' is '-'.
void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
-// Replaces the extension of |file_name| with |extension|. If |file_name|
-// does not have an extension, them |extension| is added. If |extention| is
-// empty, then the extension is removed from |file_name|.
-void ReplaceExtension(std::wstring* file_name, const std::wstring& extension);
-
//-----------------------------------------------------------------------------
// Functions that involve filesystem access or modification:
« no previous file with comments | « base/file_path.cc ('k') | base/file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698