Use llvm::sys::fs::can_execute.

llvm-svn: 184297
This commit is contained in:
Rafael Espindola 2013-06-19 13:24:29 +00:00
parent 49b4314cfd
commit 8be5c0550e
1 changed files with 10 additions and 5 deletions

View File

@ -1579,13 +1579,16 @@ std::string Driver::GetProgramPath(const char *Name,
if (!llvm::sys::fs::is_directory(*it, IsDirectory) && IsDirectory) {
llvm::sys::Path P(*it);
P.appendComponent(TargetSpecificExecutable);
if (P.canExecute()) return P.str();
if (llvm::sys::fs::can_execute(P.str()))
return P.str();
P.eraseComponent();
P.appendComponent(Name);
if (P.canExecute()) return P.str();
if (llvm::sys::fs::can_execute(P.str()))
return P.str();
} else {
llvm::sys::Path P(*it + Name);
if (P.canExecute()) return P.str();
if (llvm::sys::fs::can_execute(P.str()))
return P.str();
}
}
@ -1594,10 +1597,12 @@ std::string Driver::GetProgramPath(const char *Name,
it = List.begin(), ie = List.end(); it != ie; ++it) {
llvm::sys::Path P(*it);
P.appendComponent(TargetSpecificExecutable);
if (P.canExecute()) return P.str();
if (llvm::sys::fs::can_execute(P.str()))
return P.str();
P.eraseComponent();
P.appendComponent(Name);
if (P.canExecute()) return P.str();
if (llvm::sys::fs::can_execute(P.str()))
return P.str();
}
// If all else failed, search the path.