- Home /
creating a directory
I am trying to make a sort of patching system. I need to create a directory at runtime using a script. I have tried:
System.IO.CreateDirectory(path);
and
var newFolder = new System.IO.File(path); newFolder.mkdir()
anyone got any other suggestions?
Answer by Dunkhan · Mar 15, 2011 at 01:53 PM
System.IO.Directory.CreateDirectory(path)
Will this create a directory relative to the project? i.e. System.IO.Directory.CreateDirectory("Assets/$$anonymous$$y/New/Directory");
or is it necessary to add the project base path?
Besides the string with the directory name, I just added before it, the Application.dataPath value and it's working fine. I haven't tested on webplayer, mobile, etc, just my plain Windows 7. I created a folder outside of the game_Data folder by using (Application.dataPath+"/../$$anonymous$$yFolder").
Answer by zerocorp · Mar 07, 2014 at 05:15 PM
works for android? I try and I can not! or someone can tell me how to create a directory in android?
for Android:
string path = "/storage/emulated/0/$$anonymous$$yFolder";
if(!Directory.Exists(path))
Directory.CreateDirectory(path);
Your answer
Follow this Question
Related Questions
How do you check if a directory exists c#? 2 Answers
Get list of all files in a directory? 3 Answers
how to create a folder at the run time ? 2 Answers
How do you create a folder in c#? 3 Answers
How do you create a subfolder inside persistentDataPath in iOS? 0 Answers