From: Christian Dywan Date: Tue, 28 Aug 2012 17:37:21 +0000 (+0200) Subject: Stop using magic test folder name X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fb42ef2d7aec6dd93721aae5166593052881350;p=midori Stop using magic test folder name --- diff --git a/extensions/addons.c b/extensions/addons.c index 6087af45..4d76634b 100644 --- a/extensions/addons.c +++ b/extensions/addons.c @@ -1678,10 +1678,10 @@ addons_save_settings (MidoriApp* app, config_dir = midori_extension_get_config_dir (extension); config_file = g_build_filename (config_dir, "addons", NULL); - katze_mkdir_with_parents (config_dir, 0700); + if (config_dir != NULL) + katze_mkdir_with_parents (config_dir, 0700); sokoke_key_file_save_to_file (keyfile, config_file, &error); - /* If the folder is /, this is a test run, thus no error */ - if (error && !g_str_equal (config_dir, "/")) + if (error && midori_extension_get_config_dir (extension) != NULL) { g_warning (_("The configuration of the extension '%s' couldn't be saved: %s\n"), _("User addons"), error->message); diff --git a/extensions/formhistory/formhistory.c b/extensions/formhistory/formhistory.c index db5a2344..fca8aada 100644 --- a/extensions/formhistory/formhistory.c +++ b/extensions/formhistory/formhistory.c @@ -522,12 +522,12 @@ formhistory_activate_cb (MidoriExtension* extension, formhistory_construct_popup_gui (priv); config_dir = midori_extension_get_config_dir (extension); - katze_mkdir_with_parents (config_dir, 0700); + if (config_dir != NULL) + katze_mkdir_with_parents (config_dir, 0700); filename = g_build_filename (config_dir, "forms.db", NULL); if (sqlite3_open (filename, &db) != SQLITE_OK) { - /* If the folder is /, this is a test run, thus no error */ - if (!g_str_equal (midori_extension_get_config_dir (extension), "/")) + if (config_dir != NULL) g_warning (_("Failed to open database: %s\n"), sqlite3_errmsg (db)); sqlite3_close (db); } diff --git a/midori/midori-extension.c b/midori/midori-extension.c index aff2a14a..d134b7cc 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -646,10 +646,11 @@ midori_extension_get_config_dir (MidoriExtension* extension) if (!extension->priv->config_dir) { gchar* filename = g_object_get_data (G_OBJECT (extension), "filename"); - if (!filename) - return "/"; - extension->priv->config_dir = g_build_filename ( - midori_paths_get_config_dir (), "extensions", filename, NULL); + if (filename != NULL) + extension->priv->config_dir = g_build_filename ( + midori_paths_get_config_dir (), "extensions", filename, NULL); + else + extension->priv->config_dir = NULL; } return extension->priv->config_dir;