Replace HostInfo::GetLLDBPath with specific functions
Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
This commit is contained in:
@@ -3094,14 +3094,13 @@ void ScriptInterpreterPython::InitializePrivate() {
|
||||
PyRun_SimpleString("import sys");
|
||||
AddToSysPath(AddLocation::End, ".");
|
||||
|
||||
FileSpec file_spec;
|
||||
// Don't denormalize paths when calling file_spec.GetPath(). On platforms
|
||||
// that use a backslash as the path separator, this will result in executing
|
||||
// python code containing paths with unescaped backslashes. But Python also
|
||||
// accepts forward slashes, so to make life easier we just use that.
|
||||
if (HostInfo::GetLLDBPath(ePathTypePythonDir, file_spec))
|
||||
if (FileSpec file_spec = HostInfo::GetPythonDir())
|
||||
AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false));
|
||||
if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, file_spec))
|
||||
if (FileSpec file_spec = HostInfo::GetShlibDir())
|
||||
AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false));
|
||||
|
||||
PyRun_SimpleString("sys.dont_write_bytecode = 1; import "
|
||||
|
||||
Reference in New Issue
Block a user