aboutsummaryrefslogtreecommitdiff
path: root/libdex/OptInvocation.cpp
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2011-06-02 12:24:11 -0700
committerDan Bornstein <danfuzz@android.com>2011-06-02 15:55:42 -0700
commit6f9edbe7d3a83f7741c4d56f9f5be1414ecabc9f (patch)
treea7aef0d49b1da85dcf1c6f674623cd67ce8f4277 /libdex/OptInvocation.cpp
parent0216b58d1027f3bc99f782cc19f809093577868c (diff)
Add some error checking and clean out some cruft.
Error checking #1: When a cached dex file can't be created, do extra analysis to figure out (and report) why. Error checking #2: When opening classpath entries, become sensitive to the file extension, only trying to open files with the right extensions and complaining explicitly if it's unrecognized. Cruft cleaning: We've never supported finding class files in directory hierarchies in Dalvik. Fix some related comments and clean out some code that tried (in vain) to implement a piece of that. Bug: 4523201 Change-Id: I05b7a8570f147955cd62229fca72b50d36703752
Diffstat (limited to 'libdex/OptInvocation.cpp')
-rw-r--r--libdex/OptInvocation.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libdex/OptInvocation.cpp b/libdex/OptInvocation.cpp
index 911e9d5a0..4e88c249d 100644
--- a/libdex/OptInvocation.cpp
+++ b/libdex/OptInvocation.cpp
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
- * Utility functions for managing an invocation of "dexopt".
+ * Utility functions for dealing with optimized dex files.
*/
+
#include "vm/DalvikVersion.h"
#include <stdint.h>
@@ -30,9 +32,9 @@
#include "OptInvocation.h"
#include "DexFile.h"
+static const char* kCacheDirectoryName = "dalvik-cache";
static const char* kClassesDex = "classes.dex";
-
/*
* Given the filename of a .jar or .dex file, construct the DEX file cache
* name.
@@ -45,7 +47,6 @@ static const char* kClassesDex = "classes.dex";
char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
{
char nameBuf[512];
- static const char kDexCachePath[] = "dalvik-cache";
char absoluteFile[sizeof(nameBuf)];
const size_t kBufLen = sizeof(nameBuf) - 1;
const char* dataRoot;
@@ -95,7 +96,7 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
dataRoot = getenv("ANDROID_DATA");
if (dataRoot == NULL)
dataRoot = "/data";
- snprintf(nameBuf, kBufLen, "%s/%s", dataRoot, kDexCachePath);
+ snprintf(nameBuf, kBufLen, "%s/%s", dataRoot, kCacheDirectoryName);
/* Tack on the file name for the actual cache file path.
*/