diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 23:59:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 23:59:36 +0000 |
commit | 5e207883834dc8a2ea39684e79e6b29d46c4013b (patch) | |
tree | f63a447bff245151fc8b1d1f6a061b429e5708d2 /base | |
parent | 345e1b89c38bf19ebce483ae5392474bbf63ae59 (diff) | |
download | chromium_src-5e207883834dc8a2ea39684e79e6b29d46c4013b.zip chromium_src-5e207883834dc8a2ea39684e79e6b29d46c4013b.tar.gz chromium_src-5e207883834dc8a2ea39684e79e6b29d46c4013b.tar.bz2 |
Keep trying to undo 7564.
tbr=jhawkins
Review URL: http://codereview.chromium.org/17062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/file_path.cc | 4 | ||||
-rw-r--r-- | base/file_path.h | 2 | ||||
-rw-r--r-- | base/file_path_unittest.cc | 4 | ||||
-rw-r--r-- | base/file_util.cc | 6 | ||||
-rw-r--r-- | base/file_util_win.cc | 1 |
5 files changed, 7 insertions, 10 deletions
diff --git a/base/file_path.cc b/base/file_path.cc index 49193152..45f6e327 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -113,7 +113,7 @@ FilePath FilePath::DirName() const { return new_path; } -FilePath::StringType FilePath::BaseName() const { +FilePath FilePath::BaseName() const { FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); @@ -133,7 +133,7 @@ FilePath::StringType FilePath::BaseName() const { new_path.path_.erase(0, last_separator + 1); } - return new_path.path_; + return new_path; } FilePath FilePath::Append(const FilePath::StringType& component) const { diff --git a/base/file_path.h b/base/file_path.h index 9ba42d3..cadf2cf 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -146,7 +146,7 @@ class FilePath { // object, either a file or a directory. If this object already refers to // the root directory, returns a FilePath identifying the root directory; // this is the only situation in which BaseName will return an absolute path. - StringType BaseName() const; + FilePath BaseName() const; // Returns a FilePath by appending a separator and the supplied path // component to this object's path. Append takes care to avoid adding diff --git a/base/file_path_unittest.cc b/base/file_path_unittest.cc index 37fd41a..b4ad16f 100644 --- a/base/file_path_unittest.cc +++ b/base/file_path_unittest.cc @@ -209,8 +209,8 @@ TEST_F(FilePathTest, BaseName) { for (size_t i = 0; i < arraysize(cases); ++i) { FilePath input(cases[i].input); - FilePath::StringType observed = input.BaseName(); - EXPECT_EQ(FilePath::StringType(cases[i].expected), observed) << + FilePath observed = input.BaseName(); + EXPECT_EQ(FilePath::StringType(cases[i].expected), observed.value()) << "i: " << i << ", input: " << input.value(); } } diff --git a/base/file_util.cc b/base/file_util.cc index f0d66b5..fe33c32 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -381,11 +381,7 @@ std::wstring GetFilenameFromPath(const std::wstring& path) { if (path.empty() || EndsWithSeparator(path)) return std::wstring(); -#if defined(OS_WIN) - return FilePath::FromWStringHack(path).BaseName(); -#elif defined(OS_POSIX) - return UTF8ToWide(FilePath::FromWStringHack(path).BaseName()); -#endif + return FilePath::FromWStringHack(path).BaseName().ToWStringHack(); } bool GetFileSize(const std::wstring& file_path, int64* file_size) { return GetFileSize(FilePath::FromWStringHack(file_path), file_size); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index a36f6c9..c2dbf0a 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -739,6 +739,7 @@ void MemoryMappedFile::CloseHandles() { } // Deprecated functions ---------------------------------------------------- + void InsertBeforeExtension(std::wstring* path_str, const std::wstring& suffix) { FilePath path(*path_str); |