Skip to content

Commit

Permalink
修复带后缀名时找不到文件的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wzv5 committed Dec 21, 2016
1 parent d0aa0e3 commit 4d93b54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sudo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public static string WhereSearch(string filename)
var paths = new[] { Environment.CurrentDirectory }
.Concat(Environment.GetEnvironmentVariable("PATH").Split(';'));
var extensions = Environment.GetEnvironmentVariable("PATHEXT").ToLower().Split(';')
.Where(e => e.StartsWith("."));
.Where(e => e.StartsWith("."))
.Concat(new[] { String.Empty });
var combinations = paths.SelectMany(x => extensions,
(path, extension) => Path.Combine(path, filename + extension));
return combinations.FirstOrDefault(File.Exists);
Expand Down

0 comments on commit 4d93b54

Please sign in to comment.