Directory.CreateDirectory not working

es, exactly that. I try it with the proper syntax, and it doesn’t create the folder. Here’s my code:

Directory.CreateDirectory("~/Library/Application Support/PROJECT_TITLE");

I should see a new folder appear in ~/Library/Application Support called PROJECT_TITLE, right? I run it and trigger the function, and no errors pop up. Then I check in Finder, and the folder is not there!

EDIT:

Okay, so it turned out it was just putting all of those folders within the project folder itself. How can I make it so it does it from the root folder?

You can try to use System.Environment.GetFolderPath to get your user’s personal folder (that corresponds to “~/”) and then use System.IO.Path.Combine to combine it with the rest of path:

string homeRoot = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string newFolder = System.IO.Path.Combine(homeRoot, "Library/Application Support/PROJECT_TITLE");
System.IO.Directory.CreateDirectory(newFolder);

You can find more options of System.Environment.GetFolderPath at here.