예제 #1
0
        public static void ThrowExecutableNotFoundException(string fileName, ChildProcessFlags flags, Exception?innerException = null)
        {
            bool ignoreSearchPath = flags.HasIgnoreSearchPath();
            var  format           = ignoreSearchPath ? "Executable not found: {0}" : "Executable not found on the search path: {0}";

            throw new FileNotFoundException(string.Format(CultureInfo.InvariantCulture, format, fileName), fileName, innerException);
        }
예제 #2
0
        private static string ResolveExecutablePath(string fileName, ChildProcessFlags flags)
        {
            bool ignoreSearchPath = flags.HasIgnoreSearchPath();
            var  searchPath       = ignoreSearchPath ? null : EnvironmentSearchPathCache.ResolveSearchPath();
            var  resolvedPath     = SearchPathSearcher.FindExecutable(fileName, flags.HasAllowRelativeFileName(), searchPath);

            if (resolvedPath is null)
            {
                ThrowHelper.ThrowExecutableNotFoundException(fileName, flags);
            }
            return(resolvedPath);
        }