Browse Source

Don't save solution-wide .sdsettings file if it is unchanged.

pull/478/head
Daniel Grunwald 12 years ago
parent
commit
dc2207bccf
  1. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs
  2. 2
      src/Main/Base/Project/Project/ISolution.cs
  3. 16
      src/Main/SharpDevelop/Project/Solution.cs

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs

@ -118,7 +118,7 @@ namespace CSharpBinding.FormattingStrategy
{ {
// Load solution settings // Load solution settings
SolutionOptions = new CSharpFormattingOptionsPersistence( SolutionOptions = new CSharpFormattingOptionsPersistence(
e.Solution.GlobalPreferences, e.Solution.SDSettings,
new CSharpFormattingOptionsContainer(GlobalOptions.OptionsContainer) new CSharpFormattingOptionsContainer(GlobalOptions.OptionsContainer)
{ {
DefaultText = StringParser.Parse("${res:CSharpBinding.Formatting.SolutionOptionReference}") DefaultText = StringParser.Parse("${res:CSharpBinding.Formatting.SolutionOptionReference}")

2
src/Main/Base/Project/Project/ISolution.cs

@ -97,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// Gets a container that can be used to store data about the solution. /// Gets a container that can be used to store data about the solution.
/// This data is stored along with .sln file as .sln.sdsettings. /// This data is stored along with .sln file as .sln.sdsettings.
/// </summary> /// </summary>
Properties GlobalPreferences { get; } Properties SDSettings { get; }
/// <summary> /// <summary>
/// This event is raised by <see cref="SavePreferences"/> immediately before the preferences are saved to disk. /// This event is raised by <see cref="SavePreferences"/> immediately before the preferences are saved to disk.

16
src/Main/SharpDevelop/Project/Solution.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Project
class Solution : SolutionFolder, ISolution class Solution : SolutionFolder, ISolution
{ {
FileName fileName; FileName fileName;
FileName globalSettingsFileName; FileName sdSettingsFileName;
DirectoryName directory; DirectoryName directory;
readonly IProjectChangeWatcher changeWatcher; readonly IProjectChangeWatcher changeWatcher;
readonly IFileService fileService; readonly IFileService fileService;
@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Project
this.PlatformNames = new SolutionConfigurationOrPlatformNameCollection(this, true); this.PlatformNames = new SolutionConfigurationOrPlatformNameCollection(this, true);
this.projects = new SynchronizedModelCollection<IProject>(new ProjectModelCollection(this)); this.projects = new SynchronizedModelCollection<IProject>(new ProjectModelCollection(this));
this.FileName = fileName; this.FileName = fileName;
this.globalSettingsFileName = new FileName(fileName + ".sdsettings"); this.sdSettingsFileName = new FileName(fileName + ".sdsettings");
base.Name = fileName.GetFileNameWithoutExtension(); base.Name = fileName.GetFileNameWithoutExtension();
this.globalSections = new SynchronizedModelCollection<SolutionSection>(new NullSafeSimpleModelCollection<SolutionSection>()); this.globalSections = new SynchronizedModelCollection<SolutionSection>(new NullSafeSimpleModelCollection<SolutionSection>());
@ -281,11 +281,11 @@ namespace ICSharpCode.SharpDevelop.Project
get { return preferences; } get { return preferences; }
} }
Properties globalPreferences = new Properties(); Properties sdSettings = new Properties();
[Browsable(false)] [Browsable(false)]
public Properties GlobalPreferences { public Properties SDSettings {
get { return globalPreferences; } get { return sdSettings; }
} }
string GetPreferencesKey() string GetPreferencesKey()
@ -297,7 +297,7 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
try { try {
preferences = SD.PropertyService.LoadExtraProperties(GetPreferencesKey()); preferences = SD.PropertyService.LoadExtraProperties(GetPreferencesKey());
globalPreferences = Properties.Load(globalSettingsFileName); sdSettings = Properties.Load(sdSettingsFileName);
} catch (IOException) { } catch (IOException) {
} catch (XmlException) { } catch (XmlException) {
// ignore errors about inaccessible or malformed files // ignore errors about inaccessible or malformed files
@ -321,7 +321,9 @@ namespace ICSharpCode.SharpDevelop.Project
try { try {
SD.PropertyService.SaveExtraProperties(GetPreferencesKey(), preferences); SD.PropertyService.SaveExtraProperties(GetPreferencesKey(), preferences);
globalPreferences.Save(globalSettingsFileName); if (sdSettings.IsDirty) {
sdSettings.Save(sdSettingsFileName);
}
} catch (IOException) { } catch (IOException) {
// ignore errors writing to extra properties // ignore errors writing to extra properties
} }

Loading…
Cancel
Save