check if config file exists

This commit is contained in:
Chris Cromer 2018-11-01 22:12:12 -03:00
parent d950f0a7a2
commit 9c43963dce
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
1 changed files with 7 additions and 0 deletions

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 ());