public static void SetPath() { saveFileName = Script_Utils.SaveFile(saveSlotId); savedGameTitleDataFileName = Script_Utils.SaveTitleDataFile(saveSlotId); path = Application.persistentDataPath; saveFilePath = $"{path}/{saveFileName}"; savedGameTitleDataPath = $"{path}/{savedGameTitleDataFileName}"; Debug.Log($"Persistent path is: {Application.persistentDataPath}"); Debug.Log($"Currently using path: {path}"); }
public static bool Copy(int fromSlot, int newSlotId) { SetPath(); try { // copy saveData var fromFileName = Script_Utils.SaveFile(fromSlot); var fromTitleDataFileName = Script_Utils.SaveTitleDataFile(fromSlot); var newFileName = Script_Utils.SaveFile(newSlotId); var newTitleDataFileName = Script_Utils.SaveTitleDataFile(newSlotId); var fromFilePath = $"{path}/{fromFileName}"; var fromTitleDataFilePath = $"{path}/{fromTitleDataFileName}"; var newFilePath = $"{path}/{newFileName}"; var newTitleDataFilePath = $"{path}/{newTitleDataFileName}"; Debug.Log($"From File Path: {fromFilePath}"); Debug.Log($"To File Path: {newFilePath}"); Debug.Log($"From Title Data File Path: {fromTitleDataFilePath}"); Debug.Log($"To Title Data File Path: {newTitleDataFilePath}"); if (File.Exists(fromFilePath)) { File.Copy(fromFilePath, newFilePath, true); } // copy titleData if (File.Exists(fromTitleDataFilePath)) { File.Copy(fromTitleDataFilePath, newTitleDataFilePath, true); } return(true); } catch (System.Exception e) { Debug.LogError("Failed Copy with exception: " + e.ToString()); return(false); } }