summaryrefslogtreecommitdiffstats
path: root/libdex/OptInvocation.c
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2010-04-11 22:01:42 -0400
committerSteve Kondik <shade@chemlab.org>2010-04-11 22:01:42 -0400
commitfffa0faff28a34c6e7ed63f464cf56a4aa0b89e8 (patch)
treea917638dd424adb5af00acfa8392241e5d66e816 /libdex/OptInvocation.c
parent3cca7df4b1778c64a2464f79d88d413ade83ad85 (diff)
parentdd3802f756bf30bf61bb653a1c9960b2fd1169d3 (diff)
downloadandroid_dalvik-donut.tar.gz
android_dalvik-donut.tar.bz2
android_dalvik-donut.zip
Merge branch 'eclair' of git@github.com:cyanogen/android_dalvik into donutdonut
Diffstat (limited to 'libdex/OptInvocation.c')
-rw-r--r--libdex/OptInvocation.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/libdex/OptInvocation.c b/libdex/OptInvocation.c
index f01c5e26c..8552cfd2e 100644
--- a/libdex/OptInvocation.c
+++ b/libdex/OptInvocation.c
@@ -50,6 +50,8 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
const size_t kBufLen = sizeof(nameBuf) - 1;
const char* dataRoot;
const char* systemRoot;
+ const char* sdExtRoot;
+ const char* cacheRoot;
char* cp;
/*
@@ -82,12 +84,33 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
dataRoot = getenv("ANDROID_DATA");
systemRoot = getenv("ANDROID_ROOT");
+ sdExtRoot = getenv("SD_EXT_DIRECTORY");
+ cacheRoot = getenv("CACHE_ROOT");
+
+ /* Set some default values just in case the enviornment variables
+ * do not exist. This will probably never happen, but is good
+ * practice nonetheless.
+ */
+ if (dataRoot == NULL)
+ dataRoot = "/data";
+
+ if (systemRoot == NULL)
+ systemRoot = "/system";
- if (systemRoot != NULL && !strncmp(absoluteFile, systemRoot, strlen(systemRoot)))
- dataRoot = "/cache";
+ if (sdExtRoot == NULL)
+ sdExtRoot = "/sd-ext";
+
+ if (cacheRoot == NULL)
+ cacheRoot = "/cache";
- if (dataRoot == NULL)
- dataRoot = "/data";
+ /* Determine where to store dalvik-cache based on the
+ * location of the binary we are dexopt'ing
+ */
+ if (systemRoot != NULL && !strncmp(absoluteFile, systemRoot, strlen(systemRoot)))
+ dataRoot = cacheRoot;
+
+ if (sdExtRoot != NULL && !strncmp(absoluteFile, sdExtRoot, strlen(sdExtRoot)))
+ dataRoot = sdExtRoot;
/* Turn the path into a flat filename by replacing
* any slashes after the first one with '@' characters.