Allow files paths without directory as output paths

This commit is contained in:
Stone_Red
2025-06-27 13:01:16 +02:00
parent edc7ea95dd
commit e6943924cc
+9 -2
View File
@@ -187,7 +187,10 @@ internal static class Program
try
{
_ = Directory.CreateDirectory(Path.GetDirectoryName(jsonPath) ?? string.Empty);
if (!string.IsNullOrWhiteSpace(Path.GetDirectoryName(jsonPath)))
{
_ = Directory.CreateDirectory(Path.GetDirectoryName(jsonPath)!);
}
string json = JsonSerializer.Serialize(JsonResult.Parse([.. activeHosts], previouslyActiveHosts), jsonSerializerOptions);
File.WriteAllText(jsonPath, json);
@@ -216,7 +219,11 @@ internal static class Program
try
{
_ = Directory.CreateDirectory(Path.GetDirectoryName(csvPath) ?? string.Empty);
if (!string.IsNullOrWhiteSpace(Path.GetDirectoryName(csvPath)))
{
_ = Directory.CreateDirectory(Path.GetDirectoryName(csvPath)!);
}
File.WriteAllLines(csvPath, activeHostsTable.Select(row => string.Join(",", row)));
if (!options.Silent)