Create a new config.xml if it exists but is empty. Throw an error if the format is invalid. Fixes #315
This commit is contained in:
parent
9aeb848d33
commit
ce64d696b9
|
@ -65,10 +65,27 @@ namespace SparkleLib {
|
||||||
SparkleHelpers.DebugInfo ("Config", "Created \"" + icons_path + "\"");
|
SparkleHelpers.DebugInfo ("Config", "Created \"" + icons_path + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists (FullPath))
|
try {
|
||||||
|
Load (FullPath);
|
||||||
|
|
||||||
|
} catch (FileNotFoundException) {
|
||||||
CreateInitialConfig ();
|
CreateInitialConfig ();
|
||||||
|
|
||||||
Load (FullPath);
|
} catch (XmlException) {
|
||||||
|
|
||||||
|
FileInfo file = new FileInfo (FullPath);
|
||||||
|
|
||||||
|
if (file.Length == 0) {
|
||||||
|
File.Delete (FullPath);
|
||||||
|
CreateInitialConfig ();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new XmlException (FullPath + " does not contain a valid SparkleShare XML tree.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
Load (FullPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue