Reputation: 533
I want when I run my program to create a default folder for it in My Documents for the first use of this application (if a directory with the same name already exists then I want to keep this folder).
This is the code I tried so far:
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
System.IO.Directory.CreateDirectory(path + @"\MaBib");
Upvotes: 1
Views: 4029
Reputation: 460078
I'm not sure if i understand the question since
Directory.CreateDirectory(path)
only creates the directory if it does not exist.
Directory.CreateDirectory
Method
Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. ...
Upvotes: 9