diff options
Diffstat (limited to 'lldb/source/Host/windows/HostInfoWindows.cpp')
-rw-r--r-- | lldb/source/Host/windows/HostInfoWindows.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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; } |