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:
parent
d047e1f45c
commit
ac7f1ff7eb
|
@ -59,10 +59,13 @@ 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);
|
||||||
using (var writer = file.CreateText())
|
if (file.Exists && !file.IsReadOnly)
|
||||||
{
|
{
|
||||||
var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
using (var writer = file.CreateText())
|
||||||
Serializer.Serialize(w, config);
|
{
|
||||||
|
var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
||||||
|
Serializer.Serialize(w, config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue