summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/HostInfoBase.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-05-08 12:46:26 +0000
committerTamas Berghammer <tberghammer@google.com>2015-05-08 12:46:26 +0000
commitf3a243297b801d377d24327c5cc8c55fb951e8d8 (patch)
tree740e8f0f7f0920f956322c6da481fcc6b8611d4a /lldb/source/Host/common/HostInfoBase.cpp
parent679c2c3639d411db6cc3a793c967baeafd6d6ff5 (diff)
downloadbcm5719-llvm-f3a243297b801d377d24327c5cc8c55fb951e8d8.tar.gz
bcm5719-llvm-f3a243297b801d377d24327c5cc8c55fb951e8d8.zip
Use /data/local/tmp as temp directory on android
If no temp directory specified by the user on android then fall back to /data/local/tmp what is always present on the device. It removes the dependency of specifying TMPDIR for executing platform commands on android. Differential revision: http://reviews.llvm.org/D9569 llvm-svn: 236843
Diffstat (limited to 'lldb/source/Host/common/HostInfoBase.cpp')
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index b8456a89a80..f44ad961653 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -323,7 +323,7 @@ bool
HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec)
{
FileSpec temp_file_spec;
- if (!ComputeGlobalTempFileDirectory(temp_file_spec))
+ if (!HostInfo::ComputeGlobalTempFileDirectory(temp_file_spec))
return false;
std::string pid_str;
@@ -342,21 +342,33 @@ HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec)
}
bool
-HostInfoBase::ComputeGlobalTempFileDirectory(FileSpec &file_spec)
+HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec)
{
file_spec.Clear();
const char *tmpdir_cstr = getenv("TMPDIR");
- if (tmpdir_cstr == NULL)
+ if (tmpdir_cstr == nullptr)
{
tmpdir_cstr = getenv("TMP");
- if (tmpdir_cstr == NULL)
+ if (tmpdir_cstr == nullptr)
tmpdir_cstr = getenv("TEMP");
}
if (!tmpdir_cstr)
return false;
- FileSpec temp_file_spec(tmpdir_cstr, false);
+ file_spec = FileSpec(tmpdir_cstr, false);
+ return true;
+}
+
+bool
+HostInfoBase::ComputeGlobalTempFileDirectory(FileSpec &file_spec)
+{
+ file_spec.Clear();
+
+ FileSpec temp_file_spec;
+ if (!HostInfo::ComputeTempFileBaseDirectory(temp_file_spec))
+ return false;
+
temp_file_spec.AppendPathComponent("lldb");
if (!FileSystem::MakeDirectory(temp_file_spec.GetPath().c_str(), eFilePermissionsDirectoryDefault).Success())
return false;
OpenPOWER on IntegriCloud