Fix "file ./a.out" and file "../a.out" so that is works after recent FileSpec normalization path changes.

Test coming soon, but I want to unbreak people.

llvm-svn: 331637
This commit is contained in:
Greg Clayton 2018-05-07 14:21:04 +00:00
parent f9b3fc5e2b
commit d68dbd5ad6
1 changed files with 6 additions and 10 deletions

View File

@ -367,16 +367,12 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
user_exe_path_is_bundle = true;
if (file.IsRelative() && !user_exe_path.empty()) {
// Ignore paths that start with "./" and "../"
if (!user_exe_path.startswith("./") && !user_exe_path.startswith("../")) {
llvm::SmallString<64> cwd;
if (! llvm::sys::fs::current_path(cwd)) {
cwd += '/';
cwd += user_exe_path;
FileSpec cwd_file(cwd, false);
if (cwd_file.Exists())
file = cwd_file;
}
llvm::SmallString<64> cwd;
if (! llvm::sys::fs::current_path(cwd)) {
FileSpec cwd_file(cwd.c_str(), false);
cwd_file.AppendPathComponent(file);
if (cwd_file.Exists())
file = cwd_file;
}
}