From b0316d1357b3f82af814ea8a40ac2469b55a399a Mon Sep 17 00:00:00 2001 From: jas20202 <99250573+jas20202@users.noreply.github.com> Date: Sat, 2 Mar 2024 12:57:42 +0100 Subject: [PATCH] added check it path is valid --- PWManager.CLI/Controllers/InitController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWManager.CLI/Controllers/InitController.cs b/PWManager.CLI/Controllers/InitController.cs index 587e775..0b28214 100644 --- a/PWManager.CLI/Controllers/InitController.cs +++ b/PWManager.CLI/Controllers/InitController.cs @@ -26,6 +26,10 @@ public ExitCondition Handle(string[] args) { } var path = Prompt.Input("Where do you want to create your database file?"); + while(!Path.Exists(path)) { + Console.WriteLine("The given path does not exist."); + path = Prompt.Input("Where do you want to create your database file?"); + } var name = Prompt.Input("What's your desired user name?"); while (name.Length <= 1 || !Regex.IsMatch(name, @"^[a-zA-Z]+$")) {