Browse Source

Reflector no longer crashes if there is no configuration file present.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3324 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Justin Dearing 17 years ago
parent
commit
25eeeffd20
  1. 3
      src/AddIns/Misc/ReflectorAddIn/ReflectorAddIn/Project/Src/ReflectorSetupHelper.cs

3
src/AddIns/Misc/ReflectorAddIn/ReflectorAddIn/Project/Src/ReflectorSetupHelper.cs

@ -76,6 +76,8 @@ namespace ReflectorAddIn @@ -76,6 +76,8 @@ namespace ReflectorAddIn
string cfgFileName = Path.Combine(targetPath, ReflectorConfigName);
string cfgContent;
if (File.Exists(cfgFileName)) {
// Theres probably not much point in backing this up if we overwrite it every time.
File.Copy(cfgFileName, Path.ChangeExtension(cfgFileName, ".cfg.bak"), true);
cfgContent = File.ReadAllText(cfgFileName);
} else {
cfgContent = Environment.NewLine;
@ -105,7 +107,6 @@ namespace ReflectorAddIn @@ -105,7 +107,6 @@ namespace ReflectorAddIn
MessageService.ShowError("Cannot configure Reflector because the configuration file could not be parsed.");
} else {
cfgContent = cfgContent.Insert(insertionIndex, Environment.NewLine + "\"" + ipcServerAddInDllTargetPath + "\"");
File.Copy(cfgFileName, Path.ChangeExtension(cfgFileName, ".cfg.bak"), true);
File.WriteAllText(cfgFileName, cfgContent, System.Text.Encoding.Default);
}
}

Loading…
Cancel
Save