diff --git a/RedundancyFinderCLI/FinderCommand.cs b/RedundancyFinderCLI/FinderCommand.cs index 3c51784..8a3c8f0 100644 --- a/RedundancyFinderCLI/FinderCommand.cs +++ b/RedundancyFinderCLI/FinderCommand.cs @@ -136,13 +136,19 @@ namespace RedundancyFinderCLI var json = JsonConvert.SerializeObject(finder.Redundancies, Formatting.Indented); + var outputPath = settings.OutputPath; + //check if path is relative or absolute + if (!Path.IsPathRooted(settings.OutputPath)) + { + outputPath = Path.Combine(Directory.GetCurrentDirectory(), outputPath); + } - File.WriteAllText(settings.OutputPath, json); + File.WriteAllText(outputPath, json); - AnsiConsole.MarkupLine($"[yellow]Wrote [/]{finder.Redundancies.Count}[yellow] redundancies to [/]'{settings.OutputPath}'"); + AnsiConsole.MarkupLine($"[yellow]Wrote [/]{finder.Redundancies.Count}[yellow] redundancies to [/]'{outputPath}'"); ulong totalSize = finder.Redundancies.Select(x => (ulong)x.Value.FileSize).Aggregate((a, b) => a + b); diff --git a/RedundancyFinderCLI/Properties/launchSettings.json b/RedundancyFinderCLI/Properties/launchSettings.json index b459f95..e82bfb2 100644 --- a/RedundancyFinderCLI/Properties/launchSettings.json +++ b/RedundancyFinderCLI/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "RedundancyFinderCLI": { "commandName": "Project", - "commandLineArgs": "C:\\ -v" + "commandLineArgs": "C:\\Users\\daskn\\Pictures\\ -v" } } } \ No newline at end of file