Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
Application crashes if its configuration file is locked while it atte…
Browse files Browse the repository at this point in the history
…mpts to write down changed configuration
  • Loading branch information
Anton Kasyanov committed Jul 5, 2017
1 parent 33302f5 commit abf8162
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Eve-O-Preview/Configuration/ConfigurationStorage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using Newtonsoft.Json;

namespace EveOPreview.Configuration
Expand Down Expand Up @@ -36,8 +37,16 @@ public void Load()
public void Save()
{
string rawData = JsonConvert.SerializeObject(this._thumbnailConfig, Formatting.Indented);
string filename = this.GetConfigFileName();

File.WriteAllText(this.GetConfigFileName(), rawData);
try
{
File.WriteAllText(filename, rawData);
}
catch (IOException)
{
// Ignore error if for some reason the updated config cannot be written down
}
}

private string GetConfigFileName()
Expand Down

0 comments on commit abf8162

Please sign in to comment.