Пример #1
0
static void cache_maint_moved(FileData *fd)
{
	gchar *base;
	mode_t mode = 0755;
	const gchar *src = fd->change->source;
	const gchar *dest = fd->change->dest;

	if (!src || !dest) return;

	base = cache_get_location(CACHE_TYPE_THUMB, dest, FALSE, &mode);
	if (recursive_mkdir_if_not_exists(base, mode))
		{
		gchar *buf;
		gchar *d;

		buf = cache_find_location(CACHE_TYPE_THUMB, src);
		d = cache_get_location(CACHE_TYPE_THUMB, dest, TRUE, NULL);
		cache_file_move(buf, d);
		g_free(d);
		g_free(buf);

		buf = cache_find_location(CACHE_TYPE_SIM, src);
		d = cache_get_location(CACHE_TYPE_SIM, dest, TRUE, NULL);
		cache_file_move(buf, d);
		g_free(d);
		g_free(buf);
		}
	else
		{
		log_printf("Failed to create cache dir for move %s\n", base);
		}
	g_free(base);

	base = cache_get_location(CACHE_TYPE_METADATA, dest, FALSE, &mode);
	if (recursive_mkdir_if_not_exists(base, mode))
		{
		gchar *buf;
		gchar *d;

		buf = cache_find_location(CACHE_TYPE_METADATA, src);
		d = cache_get_location(CACHE_TYPE_METADATA, dest, TRUE, NULL);
		cache_file_move(buf, d);
		g_free(d);
		g_free(buf);
		}
	g_free(base);

	if (options->thumbnails.enable_caching && options->thumbnails.spec_standard)
		thumb_std_maint_moved(src, dest);
}
Пример #2
0
void
cache_maint_moved (CacheType type, const gchar * src, const gchar * dest)
{
    gchar  *base;
    mode_t  mode = 0755;

    if (!src || !dest)
	return;

    base = cache_get_location (type, dest, FALSE, NULL, &mode);

    if (cache_ensure_dir_exists (base, mode))
    {
	gchar  *buf;
	gchar  *d;

	if (type == CACHE_THUMBS)
	{
	    buf = cache_find_location (type, src, PORNVIEW_CACHE_THUMB_EXT);
	    d = cache_get_location (type, dest, TRUE,
				    PORNVIEW_CACHE_THUMB_EXT, NULL);
	}
	else
	{
	    buf = cache_find_location (type, src, PORNVIEW_CACHE_COMMENT_EXT);
	    d = cache_get_location (type, dest, TRUE,
				    PORNVIEW_CACHE_COMMENT_EXT, NULL);
	}

	cache_file_move (buf, d);
	g_free (d);
	g_free (buf);
    }
    else
	g_free (base);
}