Make sure the cache folder is there initially

This commit is contained in:
Christian Dywan 2009-10-22 02:48:22 +02:00
parent 6a7059ae5f
commit 6ff3e3a17d

View file

@ -36,8 +36,7 @@ web_cache_get_cached_path (MidoriExtension* extension,
/* cache_path = midori_extension_get_string (extension, "path"); */ /* cache_path = midori_extension_get_string (extension, "path"); */
if (!cache_path) if (!cache_path)
cache_path = g_build_filename (g_get_user_cache_dir (), cache_path = midori_extension_get_string (extension, "path");
PACKAGE_NAME, "web", NULL);
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1); checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
folder = g_strdup_printf ("%c%c", checksum[0], checksum[1]); folder = g_strdup_printf ("%c%c", checksum[0], checksum[1]);
sub_path = g_build_path (G_DIR_SEPARATOR_S, cache_path, folder, NULL); sub_path = g_build_path (G_DIR_SEPARATOR_S, cache_path, folder, NULL);
@ -356,11 +355,14 @@ static void
web_cache_activate_cb (MidoriExtension* extension, web_cache_activate_cb (MidoriExtension* extension,
MidoriApp* app) MidoriApp* app)
{ {
const gchar* cache_path = midori_extension_get_string (extension, "path");
KatzeArray* browsers; KatzeArray* browsers;
MidoriBrowser* browser; MidoriBrowser* browser;
guint i; guint i;
SoupSession* session = webkit_get_default_session (); SoupSession* session = webkit_get_default_session ();
katze_mkdir_with_parents (cache_path, 0700);
g_signal_connect (session, "request-queued", g_signal_connect (session, "request-queued",
G_CALLBACK (web_cache_session_request_queued_cb), extension); G_CALLBACK (web_cache_session_request_queued_cb), extension);
g_signal_connect (session, "request-unqueued", g_signal_connect (session, "request-unqueued",