check if config file exists

This commit is contained in:
2018-11-01 22:12:12 -03:00
parent d950f0a7a2
commit 9c43963dce

View File

@@ -33,6 +33,13 @@ namespace Sernatur {
GLib.Object (application: application);
Database conn;
var file = File.new_for_path ("/etc/sernatur/sernatur.conf");
if (!file.query_exists ()) {
stderr.printf (dgettext (null, "File '%s' doesn't exist.\n"), file.get_path ());
application.quit ();
return;
}
Config config = Config();
if (!config.read_file ("/etc/sernatur/sernatur.conf")) {
stderr.printf ("%s\n", config.error_message ());