summaryrefslogtreecommitdiff
path: root/libartbase/base/file_utils.h
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-11-06 17:33:14 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-11 11:08:09 +0000
commita202343b6dd492bea383f9babc427dfa2e274b7d (patch)
tree98cf212e927aec26a85de79eba31a7e367f089e4 /libartbase/base/file_utils.h
parent01df4b3a9bb31f21f451452f0ce47632dd8916ad (diff)
Consolidate the use of some constants.
Bug: 377474232 Test: atest ArtServiceTests Test: atest art_standalone_artd_tests Test: atest art_standalone_odrefresh_tests Test: atest art_standalone_libartbase_tests Test: atest art_standalone_runtime_tests Test: atest art_standalone_dex2oat_tests Change-Id: I66a29ea85176c6c6d676537fe6e4e64152360acc
Diffstat (limited to 'libartbase/base/file_utils.h')
-rw-r--r--libartbase/base/file_utils.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/libartbase/base/file_utils.h b/libartbase/base/file_utils.h
index 205cc6115d..8a25fe1d9f 100644
--- a/libartbase/base/file_utils.h
+++ b/libartbase/base/file_utils.h
@@ -33,7 +33,11 @@ static constexpr const char kArtApexDataDefaultPath[] = "/data/misc/apexdata/com
static constexpr const char kAndroidConscryptApexDefaultPath[] = "/apex/com.android.conscrypt";
static constexpr const char kAndroidI18nApexDefaultPath[] = "/apex/com.android.i18n";
-static constexpr const char kArtImageExtension[] = "art";
+static constexpr const char* kOatExtension = ".oat";
+static constexpr const char* kOdexExtension = ".odex";
+static constexpr const char* kVdexExtension = ".vdex";
+static constexpr const char* kArtExtension = ".art";
+static constexpr const char* kDmExtension = ".dm";
// These methods return the Android Root, which is the historical location of
// the Android "system" directory, containing the built Android artifacts. On
@@ -176,8 +180,11 @@ std::string GetSystemOdexFilenameForApex(std::string_view location, InstructionS
// Returns `filename` with the text after the last occurrence of '.' replaced with
// `extension`. If `filename` does not contain a period, returns a string containing `filename`,
// a period, and `new_extension`.
+// A leading period in `new_extension`, if exists, is ignored.
// Example: ReplaceFileExtension("foo.bar", "abc") == "foo.abc"
// ReplaceFileExtension("foo", "abc") == "foo.abc"
+// ReplaceFileExtension("foo.bar", ".abc") == "foo.abc"
+// ReplaceFileExtension("foo", ".abc") == "foo.abc"
std::string ReplaceFileExtension(std::string_view filename, std::string_view new_extension);
// Return whether the location is on /apex/com.android.art