--- a/config.vala Wed Oct 24 00:36:26 2012 +0400
+++ b/config.vala Wed Oct 24 00:37:04 2012 +0400
@@ -7,10 +7,12 @@
base();
hash = new Gee.HashMap<string,string>();
IOChannel cfg;
- /* try { */
+ try {
cfg = new IOChannel.file(filename,"r");
- /*} catch (FileError e) {
- File.new_for_path(filename);*/
+ } catch (FileError e) {
+ log("config", LogLevelFlags.LEVEL_ERROR, "Failed to load config file '%s'", filename);
+ return;
+ }
string section = "default";
do {
string str;
@@ -20,13 +22,11 @@
str = str[0:(long)termpos];
if ( str.has_prefix("[") && str.has_suffix("]") ) {
section = str[1:-1];
- stdout.printf("Section '%s'\n",section);
} else {
string[] parts = str.split("=",2);
if (parts.length==2) {
var nkey = rkey(section,parts[0]);
hash[nkey] = parts[1];
- stdout.printf("LOL: key: %s value: %s\n",nkey,parts[1]);
}
}
} else