public void SaveFullStandtask(bool isStudent) { int standtask_id = 0; if (!isStudent) int.TryParse(SaveStandtaskID.text, out standtask_id); else int.TryParse(SaveStudentStandtaskID.text, out standtask_id); StandtaskJSONClass standtaskJSON = new StandtaskJSONClass(standtask_id, "", ropeManager.EncodeCurrentConnectionsToJSON(), ropeManager.EncodeAllRopesToJSON()); string FullStantaskJSON = standtaskJSON.GetJSON(); string fileName = "standtask_" + standtask_id + ".json"; string folderPath; //Debug.Log("Directory.GetCurrentDirectory" + Directory.GetCurrentDirectory()); if (FolderName != "") { folderPath = Application.dataPath + "/../" + FolderName + "/"; } else { folderPath = Application.dataPath + "/../"; } Debug.Log("folderPath: " + folderPath); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); Debug.Log("folder doesn't exist"); Directory.CreateDirectory(FolderName); Debug.Log("folder was created"); } else { Debug.Log("folder alredy exist"); } //Directory.CreateDirectory(folderName); if (File.Exists(fileName)) { Debug.Log(fileName + " already exists."); return; } //StreamWriter sr = File.CreateText(folderPath + fileName); File.WriteAllText(folderPath + fileName, FullStantaskJSON); //sr.Write(FullStantaskJSON); //sr.WriteLine("This is my file."); //sr.WriteLine("I can write ints {0} or floats {1}, and so on.", 1, 4.2); //sr.Close(); }