summaryrefslogtreecommitdiff
path: root/src/compiler_llvm
diff options
context:
space:
mode:
author Shih-wei Liao <sliao@google.com> 2012-04-21 00:20:57 -0700
committer Shih-wei Liao <sliao@google.com> 2012-04-21 00:40:10 -0700
commit795e33081c73a6fead31f45b03fdfb022ef7eab8 (patch)
tree6e7c5d4ac9bd9dfc04c9bb271538b829c69e62f5 /src/compiler_llvm
parent5b04728e9a61cf038e38820eb8a82a412015d5e3 (diff)
Set materialized file names correctly.
Change-Id: I0848ad4da4f2033dd7804686e65bd44c690a2036
Diffstat (limited to 'src/compiler_llvm')
-rw-r--r--src/compiler_llvm/compilation_unit.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index a1d66f13b6..b1ca33358e 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -205,13 +205,22 @@ class ScopedTempFile {
};
bool CompilationUnit::Materialize() {
- std::string tmp_file = GetArtCacheOrDie();
- tmp_file += "/art-llvm-XXXXXX";
+ const char* android_data = getenv("ANDROID_DATA");
+ if (android_data == NULL) {
+ if (OS::DirectoryExists("/data")) {
+ android_data = "/data";
+ } else {
+ android_data = "/tmp";
+ }
+ }
+
+ std::string art_cache = GetArtCacheOrDie(android_data);
+ art_cache += "/art-llvm-XXXXXX";
// Prepare the input
- ScopedTempFile input(tmp_file);
+ ScopedTempFile input(art_cache);
if (input.GetFd() < 0) {
- PLOG(ERROR) << "Failed to save the module to the file " << tmp_file;
+ PLOG(ERROR) << "Failed to save the module to the file " << art_cache;
return false;
}
@@ -221,9 +230,9 @@ bool CompilationUnit::Materialize() {
}
// Prepare the output
- ScopedTempFile output(tmp_file);
+ ScopedTempFile output(art_cache);
if (output.GetFd() < 0) {
- PLOG(ERROR) << "Failed to prepare the output file " << tmp_file;
+ PLOG(ERROR) << "Failed to prepare the output file " << art_cache;
return false;
}