diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-23 18:39:11 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-23 18:39:11 +0000 |
commit | 051243cb316b88e2c65185de680035f1415b095d (patch) | |
tree | 8d017b3f2dccd03aa27dc2e70a13da59838c4f01 /base/file_path.cc | |
parent | 8d7594a03c4c305610a25629c20ed8fbde2b4b17 (diff) | |
download | chromium_src-051243cb316b88e2c65185de680035f1415b095d.zip chromium_src-051243cb316b88e2c65185de680035f1415b095d.tar.gz chromium_src-051243cb316b88e2c65185de680035f1415b095d.tar.bz2 |
Add a method to explicitly request a UTF8 representation of a FilePath. This is for places where you need to use a FilePath in a non-filesystem context (for example, adding a file to an archive file, or constructing a file:// URL).
Review URL: http://codereview.chromium.org/16239
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path.cc')
-rw-r--r-- | base/file_path.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/base/file_path.cc b/base/file_path.cc index 45f6e327..7cfe952 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -63,6 +63,15 @@ bool IsPathAbsolute(const FilePath::StringType& path) { } // namespace +const std::string FilePath::UTF8Value() const { +#if defined(OS_POSIX) + // TODO(erikkay): I'm not sure how to make this code always correct for Linux. + return path_; +#elif defined(OS_WIN) + return WideToUTF8(path_); +#endif +} + bool FilePath::IsSeparator(CharType character) { for (size_t i = 0; i < arraysize(kSeparators) - 1; ++i) { if (character == kSeparators[i]) { |