summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp20
-rw-r--r--lldb/source/Host/windows/HostInfoWindows.cpp14
2 files changed, 21 insertions, 13 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index a968dd93b61..a3f5e6d7c10 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -798,17 +798,23 @@ FileSpec::GetPath(char *path, size_t path_max_len, bool denormalize) const
}
std::string
-FileSpec::GetPath (bool denormalize) const
+FileSpec::GetPath(bool denormalize) const
{
llvm::SmallString<64> result;
+ GetPath(result, denormalize);
+ return std::string(result.begin(), result.end());
+}
+
+void
+FileSpec::GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize) const
+{
if (m_directory)
- result.append(m_directory.GetCString());
+ path.append(m_directory.GetCString(), m_directory.GetCString() + m_directory.GetLength());
if (m_filename)
- llvm::sys::path::append(result, m_filename.GetCString());
- if (denormalize && !result.empty())
- DeNormalize(result, m_syntax);
-
- return std::string(result.begin(), result.end());
+ llvm::sys::path::append(path, m_filename.GetCString());
+ Normalize(path, m_syntax);
+ if (denormalize && !path.empty())
+ DeNormalize(path, m_syntax);
}
ConstString
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
index b22920df226..b1c880f0ffe 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -13,7 +13,9 @@
#include "lldb/Host/windows/HostInfoWindows.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Path.h"
using namespace lldb_private;
@@ -107,11 +109,11 @@ HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)
FileSpec lldb_file_spec;
if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
return false;
-
- char raw_path[PATH_MAX];
- lldb_file_spec.AppendPathComponent("../lib/site-packages");
- lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
-
- file_spec.GetDirectory().SetCString(raw_path);
+ llvm::SmallString<64> path;
+ lldb_file_spec.GetPath(path);
+ llvm::sys::path::remove_filename(path);
+ llvm::sys::path::append(path, "lib", "site-packages");
+ std::replace(path.begin(), path.end(), '\\', '/');
+ file_spec.GetDirectory().SetString(path.c_str());
return true;
}
OpenPOWER on IntegriCloud