C# 폴더유무 확인해서 폴더생성하고 파일 쓰기

Unity3D 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);

반응형

'Unity3D' 카테고리의 다른 글

C# 전처리기 지시문  (0) 2013.02.12
유니티 안드로이드 프로젝트를 이클립스에서 실행하기.  (0) 2013.02.01
PlayerPrefs  (0) 2013.01.15
WWW.assetbundle  (1) 2013.01.14
[C#] Action 제네릭 대리자  (0) 2013.01.10
: