diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 22:15:57 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 22:15:57 +0000 |
commit | 835c74a3356031e0d7a1974c1a0ff9225bb315e1 (patch) | |
tree | 0f775f7be0ecfc469750d2cf391c3d2c9abf09b3 /base/file_path.h | |
parent | c092b6c600d77f4ece53b3bb31642963ee8be47a (diff) | |
download | chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.zip chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.tar.gz chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.tar.bz2 |
Adds AppendASCII which will append an ASCII path component.
Since this is safe to do on all platform path encodings (even Linux), this allows path components to be taken from ASCII sources without #ifdefs for the caller.
Review URL: http://codereview.chromium.org/18134
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.h')
-rw-r--r-- | base/file_path.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/base/file_path.h b/base/file_path.h index d82f8f4..053b815b 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -189,6 +189,14 @@ class FilePath { FilePath Append(const StringType& component) const WARN_UNUSED_RESULT; FilePath Append(const FilePath& component) const WARN_UNUSED_RESULT; + // Although Windows StringType is std::wstring, since the encoding it uses for + // paths is well defined, it can handle ASCII path components as well. + // Mac uses UTF8, and since ASCII is a subset of that, it works there as well. + // On Linux, although it can use any 8-bit encoding for paths, we assume that + // ASCII is a valid subset, regardless of the encoding, since many operating + // system paths will always be ASCII. + FilePath AppendASCII(const std::string& component) const WARN_UNUSED_RESULT; + // Returns true if this FilePath contains an absolute path. On Windows, an // absolute path begins with either a drive letter specification followed by // a separator character, or with two separator characters. On POSIX |