config add exception when config file is not found
This commit is contained in:
parent
d66a075b91
commit
83ca2008e8
|
@ -16,6 +16,7 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace SparkleLib {
|
||||
|
@ -30,6 +31,9 @@ namespace SparkleLib {
|
|||
|
||||
public SparkleConfig (string path)
|
||||
{
|
||||
if (!File.Exists (path))
|
||||
throw new ConfigFileNotFoundException (path + " does not exist");
|
||||
|
||||
Path = path;
|
||||
Load (Path);
|
||||
}
|
||||
|
@ -95,4 +99,11 @@ namespace SparkleLib {
|
|||
Save (Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ConfigFileNotFoundException : Exception {
|
||||
|
||||
public ConfigFileNotFoundException (string message)
|
||||
: base (message) { }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue