When saving the config file - check if the file is read-only first, if it is, don't try to save

This commit is contained in:
adelikat 2014-08-03 15:51:08 +00:00
parent d047e1f45c
commit ac7f1ff7eb
1 changed files with 6 additions and 3 deletions

View File

@ -59,12 +59,15 @@ namespace BizHawk.Client.Common
public static void Save(string filepath, object config) public static void Save(string filepath, object config)
{ {
var file = new FileInfo(filepath); var file = new FileInfo(filepath);
if (file.Exists && !file.IsReadOnly)
{
using (var writer = file.CreateText()) using (var writer = file.CreateText())
{ {
var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented }; var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
Serializer.Serialize(w, config); Serializer.Serialize(w, config);
} }
} }
}
// movie 1.0 header stuff // movie 1.0 header stuff