Skip to content

Commit

Permalink
fix: Resolved exception when argument lacks './' prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
RokyZevon committed Feb 15, 2024
1 parent 7dff17f commit 1cb52c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
Environment.Exit(1);
}

var files = Directory.GetFiles(
Path.GetDirectoryName(args[0]) ?? Environment.CurrentDirectory,
Path.GetFileName(args[0]));
var path = args[0];
var dir = Path.GetDirectoryName(path);
if (string.IsNullOrWhiteSpace(dir))
dir = Environment.CurrentDirectory;

var files = Directory.GetFiles(dir, Path.GetFileName(path));

if (files.Length == 0)
{
Expand Down

0 comments on commit 1cb52c6

Please sign in to comment.