From 8fcee6ca22ebb8616eb08223ab3ef35795ab1080 Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 19 May 2023 20:33:53 +0200 Subject: [PATCH] Store last selected Folder-Path --- Tranga-CLI/Tranga_Cli.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Tranga-CLI/Tranga_Cli.cs b/Tranga-CLI/Tranga_Cli.cs index 8c759b3..32f1f87 100644 --- a/Tranga-CLI/Tranga_Cli.cs +++ b/Tranga-CLI/Tranga_Cli.cs @@ -8,12 +8,18 @@ public static class Tranga_Cli { public static void Main(string[] args) { - Console.WriteLine("Output folder path [standard D:]:"); - string? folderPath = Console.ReadLine(); - while(folderPath is null ) - folderPath = Console.ReadLine(); - if (folderPath.Length < 1) - folderPath = "D:"; + string folderPath = Directory.GetCurrentDirectory(); + string settingsPath = Path.Join(Directory.GetCurrentDirectory(), "lastPath.setting"); + if (File.Exists(settingsPath)) + folderPath = File.ReadAllText(settingsPath); + + Console.WriteLine($"Output folder path [{folderPath}]:"); + string? tmpPath = Console.ReadLine(); + while(tmpPath is null) + tmpPath = Console.ReadLine(); + if(tmpPath.Length > 0) + folderPath = tmpPath; + File.WriteAllText(settingsPath, folderPath); Console.Write("Mode (D: Interactive only, T: TaskManager):"); ConsoleKeyInfo mode = Console.ReadKey();