示例#1
0
        public string GetCommandPathFromRootPath(string rootPath, string commandName, params string[] extensions)
        {
            if (!extensions.Any())
            {
                extensions = ExecutableExtensions.ToArray();
            }

            var commandPath = extensions.Select(e => Path.Combine(rootPath, commandName + e))
                              .FirstOrDefault(File.Exists);

            return(commandPath);
        }
示例#2
0
        public string GetCommandPath(string commandName, params string[] extensions)
        {
            if (!extensions.Any())
            {
                extensions = ExecutableExtensions.ToArray();
            }

            var commandPath = SearchPaths.Join(
                extensions,
                p => true, s => true,
                (p, s) => Path.Combine(p, commandName + s))
                              .FirstOrDefault(File.Exists);

            return(commandPath);
        }