Here's how my program like, or you can also see it from attached image:partial class Boot
{
static void Main()
{
Console.WriteLine("please input the path of your data store.");
string ds_path = Console.ReadLine();
try
{
while (true)
{
if (string.IsNullOrWhiteSpace(ds_path))
{
Console.WriteLine("you CAN'T setup your data store on an EMPTY path, please reinput!!!");
ds_path = Console.ReadLine();
}
else
{
break;
}
}
if (Directory.Exists(ds_path))
{
Console.WriteLine("you've HAD this path for other use, please reinput path!!!");
ds_path = Console.ReadLine();
}
else
{
Directory.CreateDirectory(ds_path);
Console.WriteLine("successfully created directory!");
}
}
catch (Exception e)
{
Console.WriteLine("ERROR in creating directory: " + e.Message);
}
}
```}
when i run this program, the windows powershell shows the line of words:
please input the path of your data store.
and when i input D:\data_store, which is already created and used for other purpose on my PC,
the powershell shows:
you've HAD this path for other use, please reinput path!!!
but something weired happened: the program doesn't run as planned, but it stopped with the followed words:D:\codes of vs\ConsoleApp2\bin\Debug\net8.0\ConsoleApp2.exe (process 16672) exited with code 0.
this program is used to create the data store directory of my program, when the input thing is empty it will ask the user to reinput, and if not, it will detect whether this path is used, i mean the path is already exist, if so, it will ask the user to reinput, till the user input a not-empty and not-used path.