Stop using magic test folder name

This commit is contained in:
Christian Dywan 2012-08-28 19:37:21 +02:00
parent 503f1be5c5
commit 3fb42ef2d7
3 changed files with 11 additions and 10 deletions

View file

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

View file

@ -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);
}

View file

@ -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;