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

Unified Diff: base/file_util.cc

Issue 7461132: base: Get rid of a deprecated version of file_util::GetFileExtensionFromPath(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « no previous file | base/file_util_deprecated.h » ('j') | base/file_util_deprecated.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.cc
diff --git a/base/file_util.cc b/base/file_util.cc
index 7cf67dd28e169dfb9bfdbeee2ecc1440419ed568..4748f5e20176d1714f40efdc6a242e8ef7fff2a6 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -47,15 +47,6 @@ bool EnsureEndsWithSeparator(FilePath* path) {
return true;
}
-FilePath::StringType GetFileExtensionFromPath(const FilePath& path) {
- FilePath::StringType file_name = path.BaseName().value();
- const FilePath::StringType::size_type last_dot =
- file_name.rfind(kExtensionSeparator);
- return FilePath::StringType(last_dot == FilePath::StringType::npos ?
- FILE_PATH_LITERAL("") :
- file_name, last_dot+1);
-}
-
void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix) {
FilePath::StringType& value =
const_cast<FilePath::StringType&>(path->value());
@@ -382,9 +373,10 @@ bool Delete(const std::wstring& path, bool recursive) {
return Delete(FilePath::FromWStringHack(path), recursive);
}
std::wstring GetFileExtensionFromPath(const std::wstring& path) {
- FilePath::StringType extension =
- GetFileExtensionFromPath(FilePath::FromWStringHack(path));
- return extension;
+ std::wstring file_name = FilePath(path).BaseName().value();
+ const std::wstring::size_type last_dot = file_name.rfind(kExtensionSeparator);
+ return std::wstring(last_dot == std::wstring::npos ? L""
+ : file_name, last_dot + 1);
}
FILE* OpenFile(const std::wstring& filename, const char* mode) {
return OpenFile(FilePath::FromWStringHack(filename), mode);
« no previous file with comments | « no previous file | base/file_util_deprecated.h » ('j') | base/file_util_deprecated.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698