aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/FileSystem.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-08-20 11:36:32 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-08-20 14:07:05 -0700
commit921c1b7df37d6f5353ed5fdffa117dcda0c941ba (patch)
tree66fbcd00b91155b27cf1cb53df00f111227ab6df /lldb/source/Host/common/FileSystem.cpp
parent74ca5275e9509e5ec4e9f1d9123bc10674734b20 (diff)
downloadllvm-921c1b7df37d6f5353ed5fdffa117dcda0c941ba.zip
llvm-921c1b7df37d6f5353ed5fdffa117dcda0c941ba.tar.gz
llvm-921c1b7df37d6f5353ed5fdffa117dcda0c941ba.tar.bz2
[lldb] Provide GetHomeDirectory wrapper in Host::FileSystem (NFC)
Provider a wrapper around llvm::sys::path::home_directory in the FileSystem class. This will make it possible for the reproducers to intercept the call in a central place.
Diffstat (limited to 'lldb/source/Host/common/FileSystem.cpp')
-rw-r--r--lldb/source/Host/common/FileSystem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index 0fa27d1..d295c01 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -360,6 +360,18 @@ bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) {
return true;
}
+bool FileSystem::GetHomeDirectory(SmallVectorImpl<char> &path) const {
+ return llvm::sys::path::home_directory(path);
+}
+
+bool FileSystem::GetHomeDirectory(FileSpec &file_spec) const {
+ SmallString<128> home_dir;
+ if (!GetHomeDirectory(home_dir))
+ return false;
+ file_spec.SetPath(home_dir);
+ return true;
+}
+
static int OpenWithFS(const FileSystem &fs, const char *path, int flags,
int mode) {
return const_cast<FileSystem &>(fs).Open(path, flags, mode);