public void Save() { var Path = Config.I.PropertyCollectionJsonPath; if (FileUtils.FileExists(Path)) { FileUtils.BackupFile(Path); } this.SaveToFileAsJson(Path); }
private static bool SwitchDebugReleaseMode(bool debug) { var from = debug ? ".debug" : ".release"; var to = debug ? ".release" : ".debug"; var paths = new string[] { BoltPathUtility.BoltDllPath, BoltPathUtility.BoltCompilerDLLPath, BoltPathUtility.BoltEditorDLLPath }; var abort = false; var backup = ""; foreach (var path in paths) { if (abort == true) { break; } try { backup = FileUtils.BackupFile(path); FileUtils.ExchangeFile(path, from, to); } catch (IOException) { FileUtils.BackupFile(path, true); abort = true; } finally { FileUtils.DeleteFile(backup); } } if (abort == false) { AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); } return(abort == false); }
private static bool SwitchDebugReleaseMode(bool debug) { var from = debug ? DLL_SUFIX_DEBUG : DLL_SUFIX_RELEASE; var to = debug ? DLL_SUFIX_RELEASE : DLL_SUFIX_DEBUG; var paths = new string[] { BoltPathUtility.BoltDllPath, BoltPathUtility.BoltCompilerDLLPath, BoltPathUtility.BoltEditorDLLPath }; var abort = false; var backup = ""; foreach (var path in paths) { if (abort == true) { break; } try { backup = FileUtils.BackupFile(path); FileUtils.ExchangeFile(path, from, to); } catch (IOException ex) { Debug.LogError("Aborting..."); Debug.LogException(ex); abort = true; try { FileUtils.BackupFile(path, true); } catch (Exception ex2) { Debug.LogException(ex2); } } finally { try { FileUtils.DeleteFile(backup); } catch (Exception ex) { Debug.LogException(ex); } backup = ""; } } if (abort == false) { AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); } return(abort == false); }