diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-03 16:14:46 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-03 16:14:46 +0000 |
commit | 52ab8f9091d3892f5528d5a71655d75635d1e66c (patch) | |
tree | c66d682d7753e3021eb3072d32517334199e779b /base/file_util.cc | |
parent | 5d6c69626c90ffce59fcb13eb8e66a29d400907b (diff) | |
download | chromium_src-52ab8f9091d3892f5528d5a71655d75635d1e66c.zip chromium_src-52ab8f9091d3892f5528d5a71655d75635d1e66c.tar.gz chromium_src-52ab8f9091d3892f5528d5a71655d75635d1e66c.tar.bz2 |
Always show file extensions in the shelf.
BUG=1208
Review URL: http://codereview.chromium.org/8991
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4450 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.cc')
-rw-r--r-- | base/file_util.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index ade8db1..dd00d00 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -90,13 +90,21 @@ std::wstring GetFilenameFromPath(const std::wstring& path) { // TODO(erikkay): fix this - it's not using kPathSeparator, but win unit test // are exercising '/' as a path separator as well. std::wstring::size_type pos = path.find_last_of(L"\\/"); - return std::wstring(path, pos == std::wstring::npos ? 0 : pos+1); + return std::wstring(path, pos == std::wstring::npos ? 0 : pos + 1); } std::wstring GetFileExtensionFromPath(const std::wstring& path) { std::wstring file_name = GetFilenameFromPath(path); std::wstring::size_type last_dot = file_name.rfind(L'.'); - return std::wstring(last_dot == std::wstring::npos? L"" : file_name, last_dot+1); + return std::wstring(last_dot == std::wstring::npos ? + L"" : + file_name, last_dot+1); +} + +std::wstring GetFilenameWithoutExtensionFromPath(const std::wstring& path) { + std::wstring file_name = GetFilenameFromPath(path); + std::wstring::size_type last_dot = file_name.rfind(L'.'); + return file_name.substr(0, last_dot); } void AppendToPath(std::wstring* path, const std::wstring& new_ending) { |