Merge "fs_mgr_overlayfs: Trim surrounding "@" from the per mountpoint scratch dir name" into main

This commit is contained in:
Treehugger Robot 2024-01-17 00:41:29 +00:00 committed by Gerrit Code Review
commit e746bc445b

View file

@ -98,7 +98,12 @@ std::string GetEncodedBaseDirForMountPoint(const std::string& mount_point) {
if (mount_point.empty() || !android::base::Realpath(mount_point, &normalized_path)) {
return "";
}
return android::base::StringReplace(normalized_path, "/", "@", true);
std::string_view sv(normalized_path);
if (sv != "/") {
android::base::ConsumePrefix(&sv, "/");
android::base::ConsumeSuffix(&sv, "/");
}
return android::base::StringReplace(sv, "/", "@", true);
}
static bool fs_mgr_is_dir(const std::string& path) {