diff options
author | 2018-03-09 12:54:05 +0000 | |
---|---|---|
committer | 2018-03-09 12:59:46 +0000 | |
commit | 62c2d71b583820685761519bbfe3ce1e79358e25 (patch) | |
tree | a069c70f43bb0edd5472be2e4e114b47d55fefe7 /runtime/base/file_utils.cc | |
parent | 9992e095643f6746361df03c4c98e742d9ad5899 (diff) |
Fix ReplaceFileExtension() to stop looking for '.' at '/'.
Test: new test in file_utils_test.
Test: m test-art-host-gtest
Change-Id: Iaf9d16c8595f4f88a5920549c9cee51ecd4f9d13
Diffstat (limited to 'runtime/base/file_utils.cc')
-rw-r--r-- | runtime/base/file_utils.cc | 4 |
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; |