summaryrefslogtreecommitdiff
path: root/src/generators.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2011-01-23 18:11:38 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2011-01-23 18:11:38 +0100
commit49abd46d162e1d5013a42947c200544b75ab9da1 (patch)
tree91a74f000839814a315356fd9ef7dfe787501853 /src/generators.c
parent7df97fbe8fa93141e7922a95f5ce0f9254bf41ab (diff)
downloadcataract-49abd46d162e1d5013a42947c200544b75ab9da1.tar.xz
Use g_build_{filename|path} when possible
This has a nice side effect of not having double slashes in paths anymore.
Diffstat (limited to 'src/generators.c')
-rw-r--r--src/generators.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/generators.c b/src/generators.c
index 2329953..a11ebcd 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -133,26 +133,26 @@ generate_image (TGallerySetup *setup,
if (items->type == GALLERY_TYPE_INDEX) {
if (item->thumbnail == NULL || strlen (item->thumbnail) == 0)
return FALSE;
- img_src_full = g_strconcat (path_info->src_dir, "/", item->thumbnail, NULL);
- thumb_src_full = g_strconcat (path_info->src_dir, "/", item->thumbnail, NULL);
+ img_src_full = g_build_filename (path_info->src_dir, item->thumbnail, NULL);
+ thumb_src_full = g_build_filename (path_info->src_dir, item->thumbnail, NULL);
}
else
if (items->type == GALLERY_TYPE_ALBUM) {
s1 = (item->path == NULL && item->preview) ? item->preview : item->path;
thumb_src_full = (item->thumbnail) ? item->thumbnail : s1;
- img_src_full = g_strconcat (path_info->src_dir, "/", s1, NULL);
- thumb_src_full = g_strconcat (path_info->src_dir, "/", thumb_src_full, NULL);
+ img_src_full = g_build_filename (path_info->src_dir, s1, NULL);
+ thumb_src_full = g_build_filename (path_info->src_dir, thumb_src_full, NULL);
}
/* Make paths */
s1 = item_get_thumbnail_src (setup, items, item, item_index);
- thumb_dst = g_strconcat (path_info->dest_dir, "/", setup->thumbnail_dir, "/", s1, NULL);
+ thumb_dst = g_build_filename (path_info->dest_dir, setup->thumbnail_dir, s1, NULL);
g_free (s1);
s1 = item_get_img_src (setup, items, item);
- big_dst = g_strconcat (path_info->dest_dir, "/", setup->img_big_dir, "/", s1, NULL);
+ big_dst = g_build_filename (path_info->dest_dir, setup->img_big_dir, s1, NULL);
if (item->force_fullsize || setup->override_nofullsize || (items->fullsize && ! item->force_nofullsize) ||
(! item->force_nofullsize && ! items->nofullsize && ! setup->nofullsize))
- orig_dst = g_strconcat (path_info->dest_dir, "/", setup->img_orig_dir, "/", s1, NULL);
+ orig_dst = g_build_filename (path_info->dest_dir, setup->img_orig_dir, s1, NULL);
res = (! update_when_necessary) || needs_update (thumb_src_full, thumb_dst) ||
(items->type == GALLERY_TYPE_ALBUM && (needs_update (img_src_full, big_dst) || (orig_dst && needs_update (img_src_full, orig_dst))));
g_free (s1);
@@ -220,7 +220,7 @@ generate_image (TGallerySetup *setup,
else
{
/* Copy the preview (big) image provided */
- big_src = g_strconcat (path_info->src_dir, "/", item->preview, NULL);
+ big_src = g_build_filename (path_info->src_dir, item->preview, NULL);
if (! copy_file (big_src, big_dst))
log_error ("generate_image: error copying preview image %s\n", big_src);
g_free (big_src);
@@ -487,7 +487,7 @@ write_html_album (TGallerySetup *setup,
replace_table_add_key (local_replace_table, "IMG_DESCRIPTION", item->title_description);
replace_table_add_key_printf (local_replace_table, "IMG_LIST_ID", "i%d", i + 1);
if (items->type == GALLERY_TYPE_INDEX) {
- s3 = g_strconcat (path_info->src_dir, "/", item->path, "/index.xml", NULL);
+ s3 = g_build_filename (path_info->src_dir, item->path, "index.xml", NULL);
replace_table_add_key_int (local_replace_table, "ALBUM_NUM_ITEMS", get_album_objects_count (s3));
g_free (s3);
}
@@ -630,15 +630,15 @@ write_html_image (TGallerySetup *setup,
imgname = g_path_get_basename ((item->path == NULL && item->preview) ? item->preview : item->path);
if (next_item && setup->preload) {
s1 = g_path_get_basename ((next_item->path == NULL && next_item->preview) ? next_item->preview : next_item->path);
- preload_imgname = g_strconcat (setup->img_big_dir, "/", s1, NULL);
+ preload_imgname = g_build_filename (setup->img_big_dir, s1, NULL);
g_free (s1);
}
- big_dst = g_strconcat (path_info->dest_dir, "/", setup->img_big_dir, "/", imgname, NULL);
- orig_dst = g_strconcat (path_info->dest_dir, "/", setup->img_orig_dir, "/", imgname, NULL);
+ big_dst = g_build_filename (path_info->dest_dir, setup->img_big_dir, imgname, NULL);
+ orig_dst = g_build_filename (path_info->dest_dir, setup->img_orig_dir, imgname, NULL);
res = TRUE;
/* Get EXIF data from the original image */
- s1 = g_strconcat (path_info->src_dir, "/", (item->path == NULL && item->preview) ? item->preview : item->path, NULL);
+ s1 = g_build_filename (path_info->src_dir, (item->path == NULL && item->preview) ? item->preview : item->path, NULL);
exif = get_exif (s1);
g_free (s1);
if (exif == NULL)
@@ -690,9 +690,9 @@ write_html_image (TGallerySetup *setup,
if (title_desc) title_desc = g_strstrip (title_desc);
/* Page title */
- s1 = (title && strlen (title) > 0) ? g_strdup_printf("%s | ", title) : NULL;
+ s1 = (title && strlen (title) > 0) ? g_strdup_printf ("%s | ", title) : NULL;
s2 = g_strdup_printf ("%s [%d/%d]", parent_items->title ? parent_items->title : parent_items->ID, real_item_index, real_total_items);
- s3 = setup->site_title ? g_strdup_printf(" | %s", setup->site_title) : NULL;
+ s3 = setup->site_title ? g_strdup_printf (" | %s", setup->site_title) : NULL;
s4 = g_strconcat (s1 ? s1 : "", s2, s3 ? s3 : "", NULL);
replace_table_add_key (replace_table, "PAGE_TITLE", s4);
g_free (s1);