[Xfce4-commits] <midori:master> Store cached files in subfolders
Christian Dywan
noreply at xfce.org
Tue Oct 20 17:58:01 CEST 2009
Updating branch refs/heads/master
to ea6ae9b9e68db5ca5e2bb8b342372cdff34fa969 (commit)
from da65b5d0c12c744a1194d5a88d5b364e144f17a3 (commit)
commit ea6ae9b9e68db5ca5e2bb8b342372cdff34fa969
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Oct 20 17:28:42 2009 +0200
Store cached files in subfolders
extensions/web-cache.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/extensions/web-cache.c b/extensions/web-cache.c
index 946fa7a..8f439e8 100644
--- a/extensions/web-cache.c
+++ b/extensions/web-cache.c
@@ -26,18 +26,23 @@ web_cache_get_cached_path (const gchar* cache_path,
const gchar* uri)
{
gchar* checksum;
+ gchar* folder;
+ gchar* sub_path;
gchar* extension;
gchar* cached_filename;
gchar* cached_path;
- g_mkdir_with_parents (cache_path, 0700);
checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
+ folder = g_strdup_printf ("%c%c", checksum[0], checksum[1]);
+ sub_path = g_build_path (G_DIR_SEPARATOR_S, cache_path, folder, NULL);
+ g_mkdir (sub_path, 0700);
+ g_free (folder);
extension = g_strrstr (uri, ".");
cached_filename = g_strdup_printf ("%s%s", checksum,
extension ? extension : "");
g_free (checksum);
- cached_path = g_build_filename (cache_path, cached_filename, NULL);
+ cached_path = g_build_filename (sub_path, cached_filename, NULL);
g_free (cached_filename);
return cached_path;
}
More information about the Xfce4-commits
mailing list