Fix an issue with finding python on Windows.
Someone must have changed the behavior of FileSpec slightly
relating to whether or not there is a trailing backslash when calling
GetPath() and GetDirectory(). This caused ScriptInterpreterPython
to find the wrong values when initializing sys.path, and as a result
we couldn't find the lldb module.
This patch fixes the issue, and also adds a test to make sure that
GetDirectory() does not return a string containing a trailing slash.
llvm-svn: 237282
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
index b1c880f..6dce71d 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -109,8 +109,7 @@
FileSpec lldb_file_spec;
if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
return false;
- llvm::SmallString<64> path;
- lldb_file_spec.GetPath(path);
+ llvm::SmallString<64> path(lldb_file_spec.GetDirectory().AsCString());
llvm::sys::path::remove_filename(path);
llvm::sys::path::append(path, "lib", "site-packages");
std::replace(path.begin(), path.end(), '\\', '/');