From: Christian Dywan Date: Mon, 16 Feb 2009 02:05:25 +0000 (+0100) Subject: Fix config file writability test and search engine error workaround X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d754d2d510e9a7311474c897a3539e99b4b12c8;p=midori Fix config file writability test and search engine error workaround After the change to recognize read-only configuration files new files would never be written anymore. Also the default search engines wouldn't be used if no search engines file existed. --- diff --git a/midori/main.c b/midori/main.c index fcadcd1c..d412cd99 100644 --- a/midori/main.c +++ b/midori/main.c @@ -32,7 +32,9 @@ #if HAVE_UNISTD_H #include - #define is_writable(_cfg_filename) !g_access (_cfg_filename, W_OK) + #define is_writable(_cfg_filename) \ + !g_access (_cfg_filename, W_OK) || \ + !g_file_test (_cfg_filename, G_FILE_TEST_EXISTS) #else #define is_writable(_cfg_filename) 1 #endif @@ -1823,7 +1825,8 @@ main (int argc, error = NULL; search_engines = search_engines_new_from_file (config_file, &error); /* We ignore for instance empty files */ - if (error && error->code == G_KEY_FILE_ERROR_PARSE) + if (error && (error->code == G_KEY_FILE_ERROR_PARSE + || error->code == G_FILE_ERROR_NOENT)) { g_error_free (error); error = NULL;