installd: Simplify Dalvik cache path creation
Installd computes Dalvik cache path for a dex file by concatenating
'/classes.dex' to the APKs absolute path and then replacing all '/'
characters with '@'. OTA preopt does the same, only in reverse order,
i.e by concatenating '@classes.dex' to altered absolute path.
This patch unifies the two approaches so as to keep only one string
constant.
Change-Id: I69bb6bca831f45c873a0eb8580cf8d4b011f3b09
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index 1583f86..d5c3ccd 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -151,12 +151,11 @@
return false;
}
- sprintf(path,"%s%s/%s/%s%s",
+ sprintf(path,"%s%s/%s/%s",
android_data_dir.path,
DALVIK_CACHE,
instruction_set,
- src + 1, /* skip the leading / */
- DALVIK_CACHE_POSTFIX);
+ src + 1 /* skip the leading / */);
char* tmp =
path +
@@ -171,6 +170,7 @@
}
}
+ strcat(path, DALVIK_CACHE_POSTFIX);
return true;
}