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

Unified Diff: base/file_util.cc

Issue 8991: Always show file extensions in the shelf. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months 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_util.h ('k') | chrome/browser/views/download_item_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.cc
===================================================================
--- base/file_util.cc (revision 4245)
+++ base/file_util.cc (working copy)
@@ -89,15 +89,23 @@
// 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) {
if (!path) {
NOTREACHED();
« no previous file with comments | « base/file_util.h ('k') | chrome/browser/views/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698