From 9d754d2d510e9a7311474c897a3539e99b4b12c8 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 16 Feb 2009 03:05:25 +0100 Subject: [PATCH] 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. --- midori/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; -- 2.39.5