Unity3D
C# 폴더유무 확인해서 폴더생성하고 파일 쓰기
일등하이
2013. 1. 28. 16:07
반응형
Debug.LogWarning("There is no file on local.");
// Create New Folder
string sDirPath;
sDirPath = Application.persistentDataPath + "/root/configuration";
DirectoryInfo di = new DirectoryInfo(sDirPath);
if (di.Exists == false)
{
di.Create();
}
// Write File
FileStream fs = new FileStream(Application.persistentDataPath + "/root/configuration/configuration.json", FileMode.CreateNew);
byte[] info = new UTF8Encoding(true).GetBytes(source);
fs.Write(info, 0, info.Length);
반응형