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

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

@ -97,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -97,7 +97,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// Gets a container that can be used to store data about the solution.
/// This data is stored along with .sln file as .sln.sdsettings.
/// </summary>
Properties GlobalPreferences { get; }
Properties SDSettings { get; }
/// <summary>
/// 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 @@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Project
class Solution : SolutionFolder, ISolution
{
FileName fileName;
FileName globalSettingsFileName;
FileName sdSettingsFileName;
DirectoryName directory;
readonly IProjectChangeWatcher changeWatcher;
readonly IFileService fileService;
@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Project
this.PlatformNames = new SolutionConfigurationOrPlatformNameCollection(this, true);
this.projects = new SynchronizedModelCollection<IProject>(new ProjectModelCollection(this));
this.FileName = fileName;
this.globalSettingsFileName = new FileName(fileName + ".sdsettings");
this.sdSettingsFileName = new FileName(fileName + ".sdsettings");
base.Name = fileName.GetFileNameWithoutExtension();
this.globalSections = new SynchronizedModelCollection<SolutionSection>(new NullSafeSimpleModelCollection<SolutionSection>());
@ -281,11 +281,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -281,11 +281,11 @@ namespace ICSharpCode.SharpDevelop.Project
get { return preferences; }
}
Properties globalPreferences = new Properties();
Properties sdSettings = new Properties();
[Browsable(false)]
public Properties GlobalPreferences {
get { return globalPreferences; }
public Properties SDSettings {
get { return sdSettings; }
}
string GetPreferencesKey()
@ -297,7 +297,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -297,7 +297,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
try {
preferences = SD.PropertyService.LoadExtraProperties(GetPreferencesKey());
globalPreferences = Properties.Load(globalSettingsFileName);
sdSettings = Properties.Load(sdSettingsFileName);
} catch (IOException) {
} catch (XmlException) {
// ignore errors about inaccessible or malformed files
@ -321,7 +321,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -321,7 +321,9 @@ namespace ICSharpCode.SharpDevelop.Project
try {
SD.PropertyService.SaveExtraProperties(GetPreferencesKey(), preferences);
globalPreferences.Save(globalSettingsFileName);
if (sdSettings.IsDirty) {
sdSettings.Save(sdSettingsFileName);
}
} catch (IOException) {
// ignore errors writing to extra properties
}

Loading…
Cancel
Save