From ac7f1ff7ebe44dcb672a35b595a41f9b462bf300 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 3 Aug 2014 15:51:08 +0000 Subject: [PATCH] When saving the config file - check if the file is read-only first, if it is, don't try to save --- BizHawk.Client.Common/config/ConfigService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/config/ConfigService.cs b/BizHawk.Client.Common/config/ConfigService.cs index 937077dcda..425a1a2ef7 100644 --- a/BizHawk.Client.Common/config/ConfigService.cs +++ b/BizHawk.Client.Common/config/ConfigService.cs @@ -59,10 +59,13 @@ namespace BizHawk.Client.Common public static void Save(string filepath, object config) { var file = new FileInfo(filepath); - using (var writer = file.CreateText()) + if (file.Exists && !file.IsReadOnly) { - var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented }; - Serializer.Serialize(w, config); + using (var writer = file.CreateText()) + { + var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented }; + Serializer.Serialize(w, config); + } } }