summaryrefslogtreecommitdiff
path: root/runtime/base/file_utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/base/file_utils.cc')
-rw-r--r--runtime/base/file_utils.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc
index f9d0d12d88..1cb3b9c380 100644
--- a/runtime/base/file_utils.cc
+++ b/runtime/base/file_utils.cc
@@ -306,8 +306,8 @@ std::string GetSystemImageFilename(const char* location, const InstructionSet is
}
std::string ReplaceFileExtension(const std::string& filename, const std::string& new_extension) {
- const size_t last_ext = filename.find_last_of('.');
- if (last_ext == std::string::npos) {
+ const size_t last_ext = filename.find_last_of("./");
+ if (last_ext == std::string::npos || filename[last_ext] != '.') {
return filename + "." + new_extension;
} else {
return filename.substr(0, last_ext + 1) + new_extension;