Change back all paths returns for lldb::PathType enumerations from HostInfo::GetLLDBPath() to return the directories in the FileSpec.m_directory field to match previous implementations. This change previously broke some path stuff in upstream branches.

llvm-svn: 216398
This commit is contained in:
Greg Clayton
2014-08-25 18:21:06 +00:00
parent dae941a6c8
commit 0d8400c89c
5 changed files with 17 additions and 16 deletions

View File

@@ -228,7 +228,7 @@ HostInfoBase::ComputeSharedLibraryDirectory(FileSpec &file_spec)
Host::GetModuleFileSpecForHostAddress(reinterpret_cast<void *>(reinterpret_cast<intptr_t>(HostInfoBase::GetLLDBPath))));
// Remove the filename so that this FileSpec only represents the directory.
file_spec.SetFile(lldb_file_spec.GetDirectory().AsCString(), true);
file_spec.GetDirectory() = lldb_file_spec.GetDirectory();
return (bool)file_spec.GetDirectory();
}
@@ -264,7 +264,7 @@ HostInfoBase::ComputeTempFileDirectory(FileSpec &file_spec)
// Make an atexit handler to clean up the process specify LLDB temp dir
// and all of its contents.
::atexit(CleanupProcessSpecificLLDBTempDir);
file_spec.SetFile(pid_tmpdir.GetString().c_str(), false);
file_spec.GetDirectory().SetCStringWithLength(pid_tmpdir.GetString().c_str(), pid_tmpdir.GetString().size());
return true;
}

View File

@@ -194,7 +194,8 @@ HostInfoLinux::GetProgramFileSpec()
bool
HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec)
{
file_spec.SetFile("/usr/lib/lldb", true);
FileSpec temp_file("/usr/lib/lldb", true);
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}
@@ -204,17 +205,15 @@ HostInfoLinux::ComputeUserPluginsDirectory(FileSpec &file_spec)
// XDG Base Directory Specification
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
// If XDG_DATA_HOME exists, use that, otherwise use ~/.local/share/lldb.
FileSpec lldb_file_spec;
const char *xdg_data_home = getenv("XDG_DATA_HOME");
if (xdg_data_home && xdg_data_home[0])
{
std::string user_plugin_dir(xdg_data_home);
user_plugin_dir += "/lldb";
lldb_file_spec.SetFile(user_plugin_dir.c_str(), true);
file_spec.GetDirectory().SetCString(user_plugin_dir.c_str());
}
else
lldb_file_spec.SetFile("~/.local/share/lldb", true);
file_spec.GetDirectory().SetCString("~/.local/share/lldb");
return true;
}

View File

@@ -149,7 +149,7 @@ HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec)
::strncpy(framework_pos, "/Resources", PATH_MAX - (framework_pos - raw_path));
#endif
}
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return (bool)file_spec.GetDirectory();
}
@@ -169,7 +169,7 @@ HostInfoMacOSX::ComputeHeaderDirectory(FileSpec &file_spec)
framework_pos += strlen("LLDB.framework");
::strncpy(framework_pos, "/Headers", PATH_MAX - (framework_pos - raw_path));
}
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return true;
}
@@ -199,7 +199,7 @@ HostInfoMacOSX::ComputePythonDirectory(FileSpec &file_spec)
// We may get our string truncated. Should we protect this with an assert?
::strncat(raw_path, python_version_dir.c_str(), sizeof(raw_path) - strlen(raw_path) - 1);
}
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return true;
}
@@ -218,14 +218,15 @@ HostInfoMacOSX::ComputeSystemPluginsDirectory(FileSpec &file_spec)
framework_pos += strlen("LLDB.framework");
::strncpy(framework_pos, "/Resources/PlugIns", PATH_MAX - (framework_pos - raw_path));
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return true;
}
bool
HostInfoMacOSX::ComputeUserPluginsDirectory(FileSpec &file_spec)
{
file_spec.SetFile("~/Library/Application Support/LLDB/PlugIns", true);
FileSpec temp_file("~/Library/Application Support/LLDB/PlugIns", true);
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}

View File

@@ -158,14 +158,15 @@ HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec)
log->Printf("Host::%s() failed to find /lib/liblldb within the shared lib path, bailing on bin path construction",
__FUNCTION__);
}
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return (bool)file_spec.GetDirectory();
}
bool
HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec)
{
file_spec.SetFile("/opt/local/include/lldb", false);
FileSpec temp_file("/opt/local/include/lldb", false);
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}
@@ -187,6 +188,6 @@ HostInfoPosix::ComputePythonDirectory(FileSpec &file_spec)
// We may get our string truncated. Should we protect this with an assert?
::strncat(raw_path, python_version_dir.c_str(), sizeof(raw_path) - strlen(raw_path) - 1);
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return true;
}

View File

@@ -107,6 +107,6 @@ HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)
lldb_file_spec.AppendPathComponent("../lib/site-packages");
lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
file_spec.SetFile(raw_path, true);
file_spec.GetDirectory().SetCString(raw_path);
return true;
}