don't attempt to overwrite advanced settings file if contents are unchanged
This commit is contained in:
parent
20a9e4b651
commit
3c1c718bc7
@ -118,12 +118,13 @@ namespace FileManager
|
|||||||
}
|
}
|
||||||
private string getLiberationFilesSettingFromJson()
|
private string getLiberationFilesSettingFromJson()
|
||||||
{
|
{
|
||||||
|
string startingContents = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(APPSETTINGS_JSON))
|
if (File.Exists(APPSETTINGS_JSON))
|
||||||
{
|
{
|
||||||
var appSettingsContents = File.ReadAllText(APPSETTINGS_JSON);
|
startingContents = File.ReadAllText(APPSETTINGS_JSON);
|
||||||
var jObj = JObject.Parse(appSettingsContents);
|
var jObj = JObject.Parse(startingContents);
|
||||||
|
|
||||||
if (jObj.ContainsKey(LIBATION_FILES))
|
if (jObj.ContainsKey(LIBATION_FILES))
|
||||||
{
|
{
|
||||||
@ -137,7 +138,11 @@ namespace FileManager
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
File.WriteAllText(APPSETTINGS_JSON, new JObject { { LIBATION_FILES, APP_DIR } }.ToString(Formatting.Indented));
|
var endingContents = new JObject { { LIBATION_FILES, APP_DIR } }.ToString(Formatting.Indented);
|
||||||
|
|
||||||
|
if (startingContents != endingContents)
|
||||||
|
File.WriteAllText(APPSETTINGS_JSON, endingContents);
|
||||||
|
|
||||||
return APP_DIR;
|
return APP_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,13 +179,14 @@ namespace FileManager
|
|||||||
libationFilesPathCache = null;
|
libationFilesPathCache = null;
|
||||||
|
|
||||||
|
|
||||||
var contents = File.ReadAllText(APPSETTINGS_JSON);
|
var startingContents = File.ReadAllText(APPSETTINGS_JSON);
|
||||||
var jObj = JObject.Parse(contents);
|
var jObj = JObject.Parse(startingContents);
|
||||||
|
|
||||||
jObj[LIBATION_FILES] = directory;
|
jObj[LIBATION_FILES] = directory;
|
||||||
|
|
||||||
var output = JsonConvert.SerializeObject(jObj, Formatting.Indented);
|
var endingContents = JsonConvert.SerializeObject(jObj, Formatting.Indented);
|
||||||
File.WriteAllText(APPSETTINGS_JSON, output);
|
if (startingContents != endingContents)
|
||||||
|
File.WriteAllText(APPSETTINGS_JSON, endingContents);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user