always get absolute outputpath

This commit is contained in:
nihil 2025-05-10 15:44:12 +02:00
parent e6e259ed47
commit a84450cd5e
2 changed files with 9 additions and 3 deletions

View File

@ -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);

View File

@ -2,7 +2,7 @@
"profiles": {
"RedundancyFinderCLI": {
"commandName": "Project",
"commandLineArgs": "C:\\ -v"
"commandLineArgs": "C:\\Users\\daskn\\Pictures\\ -v"
}
}
}