[Host] Use FileSystem wrapper

Fixes Host.mm to use the FileSystem class instead of making native calls
to check if a file exists.

llvm-svn: 348779
This commit is contained in:
Jonas Devlieghere 2018-12-10 18:17:39 +00:00
parent 5f503b47cb
commit 046c390356
1 changed files with 8 additions and 10 deletions

View File

@ -1273,21 +1273,19 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) {
Status error;
FileSystem &fs = FileSystem::Instance();
FileSpec exe_spec(launch_info.GetExecutableFile());
llvm::sys::fs::file_status stats;
status(exe_spec.GetPath(), stats);
if (!exists(stats)) {
if (!fs.Exists(exe_spec))
FileSystem::Instance().Resolve(exe_spec);
status(exe_spec.GetPath(), stats);
}
if (!exists(stats)) {
if (!fs.Exists(exe_spec))
FileSystem::Instance().ResolveExecutableLocation(exe_spec);
status(exe_spec.GetPath(), stats);
}
if (!exists(stats)) {
if (!fs.Exists(exe_spec)) {
error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'",
launch_info.GetExecutableFile());
exe_spec);
return error;
}