- Home /
Question by
LukaKotar · Jul 15, 2013 at 10:21 PM ·
assetdatabasefolderdirectory
Check if directory is valid
Hi. I would like to show an on-screen error if an entered directory is invalid. How would I check if it exists?
Comment
Best Answer
Answer by Memige · Jul 15, 2013 at 10:27 PM
System.IO.Directory.Exists(myFolderPath)
returns a bool, if it returns false the path doesn't exist. You can then either pop up the error message, or attempt to create the directory using System.IO.Directory.CreateDirectory(myNewFolderPath)
Actually to check the name of the directory if it is inside the resources folder, you need to include the full path as "Assets/Resources/check_me_folder"... (for example for excluded folders in specific builds)