summaryrefslogtreecommitdiff
path: root/runtime/oat_file_assistant.cc
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-08-09 14:58:30 +0100
committer Jiakai Zhang <jiakaiz@google.com> 2023-10-10 19:01:06 +0000
commit07b3996128bcc5f6cdc6421f72d89c12cbdabd7a (patch)
treee028bb55cb112175ef381c5fce6ba9c64a68073c /runtime/oat_file_assistant.cc
parent803a8861442c2ce859606d8bc03247e591d0e8c0 (diff)
Support a dex file without an extension.
For such a dex file, just append ".odex" to the filename. Bug: 295161587 Test: atest art_standalone_runtime_tests Test: atest CtsCompilationTestCases Change-Id: Ibf07811d18105197818aa36ccae7588f9713c142 Merged-In: Ibf07811d18105197818aa36ccae7588f9713c142
Diffstat (limited to 'runtime/oat_file_assistant.cc')
-rw-r--r--runtime/oat_file_assistant.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index ed36df4091..1087ae7888 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -651,11 +651,7 @@ bool OatFileAssistant::DexLocationToOdexFilename(const std::string& location,
// Get the base part of the file without the extension.
std::string file = location.substr(pos + 1);
pos = file.rfind('.');
- if (pos == std::string::npos) {
- *error_msg = "Dex location " + location + " has no extension.";
- return false;
- }
- std::string base = file.substr(0, pos);
+ std::string base = pos != std::string::npos ? file.substr(0, pos) : file;
*odex_filename = dir + "/" + base + ".odex";
return true;