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,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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue