summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/file_util.cc18
-rw-r--r--base/file_util_deprecated.h1
2 files changed, 5 insertions, 14 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index 7cf67dd2..9c3381e 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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);
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h
index d24e54d..675ee61 100644
--- a/base/file_util_deprecated.h
+++ b/base/file_util_deprecated.h
@@ -32,7 +32,6 @@ BASE_API FILE* OpenFile(const std::wstring& filename, const char* mode);
BASE_API void AppendToPath(std::wstring* path, const std::wstring& new_ending);
// Use FilePath::Extension instead.
-BASE_API FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
BASE_API std::wstring GetFileExtensionFromPath(const std::wstring& path);
// Use version that takes a FilePath.