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.
This commit is contained in:
Christian Dywan 2009-02-16 03:05:25 +01:00
parent 1c029e8948
commit 9d754d2d51

View file

@ -32,7 +32,9 @@
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#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 #else
#define is_writable(_cfg_filename) 1 #define is_writable(_cfg_filename) 1
#endif #endif
@ -1823,7 +1825,8 @@ main (int argc,
error = NULL; error = NULL;
search_engines = search_engines_new_from_file (config_file, &error); search_engines = search_engines_new_from_file (config_file, &error);
/* We ignore for instance empty files */ /* 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); g_error_free (error);
error = NULL; error = NULL;