Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit dc2207b

Browse files
committed
Don't save solution-wide .sdsettings file if it is unchanged.
1 parent 58f0ba8 commit dc2207b

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void SolutionOpened(object sender, SolutionEventArgs e)
118118
{
119119
// Load solution settings
120120
SolutionOptions = new CSharpFormattingOptionsPersistence(
121-
e.Solution.GlobalPreferences,
121+
e.Solution.SDSettings,
122122
new CSharpFormattingOptionsContainer(GlobalOptions.OptionsContainer)
123123
{
124124
DefaultText = StringParser.Parse("${res:CSharpBinding.Formatting.SolutionOptionReference}")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public interface ISolution : ISolutionFolder, ICanBeDirty, IConfigurable, IDispo
9797
/// Gets a container that can be used to store data about the solution.
9898
/// This data is stored along with .sln file as .sln.sdsettings.
9999
/// </summary>
100-
Properties GlobalPreferences { get; }
100+
Properties SDSettings { get; }
101101

102102
/// <summary>
103103
/// This event is raised by <see cref="SavePreferences"/> immediately before the preferences are saved to disk.

src/Main/SharpDevelop/Project/Solution.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Project
3535
class Solution : SolutionFolder, ISolution
3636
{
3737
FileName fileName;
38-
FileName globalSettingsFileName;
38+
FileName sdSettingsFileName;
3939
DirectoryName directory;
4040
readonly IProjectChangeWatcher changeWatcher;
4141
readonly IFileService fileService;
@@ -52,7 +52,7 @@ public Solution(FileName fileName, IProjectChangeWatcher changeWatcher, IFileSer
5252
this.PlatformNames = new SolutionConfigurationOrPlatformNameCollection(this, true);
5353
this.projects = new SynchronizedModelCollection<IProject>(new ProjectModelCollection(this));
5454
this.FileName = fileName;
55-
this.globalSettingsFileName = new FileName(fileName + ".sdsettings");
55+
this.sdSettingsFileName = new FileName(fileName + ".sdsettings");
5656
base.Name = fileName.GetFileNameWithoutExtension();
5757

5858
this.globalSections = new SynchronizedModelCollection<SolutionSection>(new NullSafeSimpleModelCollection<SolutionSection>());
@@ -281,11 +281,11 @@ public Properties Preferences {
281281
get { return preferences; }
282282
}
283283

284-
Properties globalPreferences = new Properties();
284+
Properties sdSettings = new Properties();
285285

286286
[Browsable(false)]
287-
public Properties GlobalPreferences {
288-
get { return globalPreferences; }
287+
public Properties SDSettings {
288+
get { return sdSettings; }
289289
}
290290

291291
string GetPreferencesKey()
@@ -297,7 +297,7 @@ internal void LoadPreferences()
297297
{
298298
try {
299299
preferences = SD.PropertyService.LoadExtraProperties(GetPreferencesKey());
300-
globalPreferences = Properties.Load(globalSettingsFileName);
300+
sdSettings = Properties.Load(sdSettingsFileName);
301301
} catch (IOException) {
302302
} catch (XmlException) {
303303
// ignore errors about inaccessible or malformed files
@@ -321,7 +321,9 @@ public void SavePreferences()
321321

322322
try {
323323
SD.PropertyService.SaveExtraProperties(GetPreferencesKey(), preferences);
324-
globalPreferences.Save(globalSettingsFileName);
324+
if (sdSettings.IsDirty) {
325+
sdSettings.Save(sdSettingsFileName);
326+
}
325327
} catch (IOException) {
326328
// ignore errors writing to extra properties
327329
}

0 commit comments

Comments
 (0)