diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/file_path.cc | 9 | ||||
-rw-r--r-- | base/file_path.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/base/file_path.cc b/base/file_path.cc index fa93b2a..6134f2b 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -310,6 +310,15 @@ FilePath FilePath::InsertBeforeExtension(const StringType& suffix) const { return FilePath(ret); } +FilePath FilePath::InsertBeforeExtensionASCII(const StringPiece& suffix) const { + DCHECK(IsStringASCII(suffix)); +#if defined(OS_WIN) + return InsertBeforeExtension(ASCIIToWide(suffix)); +#elif defined(OS_POSIX) + return InsertBeforeExtension(suffix.as_string()); +#endif +} + FilePath FilePath::ReplaceExtension(const StringType& extension) const { if (path_.empty()) return FilePath(); diff --git a/base/file_path.h b/base/file_path.h index 17653d1..3d19c01 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -186,6 +186,7 @@ class FilePath { // path == "C:\pics\jojo" suffix == " (1)", returns "C:\pics\jojo (1)" // path == "C:\pics.old\jojo" suffix == " (1)", returns "C:\pics.old\jojo (1)" FilePath InsertBeforeExtension(const StringType& suffix) const; + FilePath InsertBeforeExtensionASCII(const StringPiece& suffix) const; // Replaces the extension of |file_name| with |extension|. If |file_name| // does not have an extension, them |extension| is added. If |extension| is |