ctucx.git: gallery

static-site-generator for image-galleries [used @ photos.ctu.cx]

commit 48dfabc4e8058e27db764f17f63b47a995eb1bcb
parent 92c8605b8227e46b02601354d7094171de709e5f
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 27 Feb 2021 22:27:28 +0100

gallery.nim: use joinPath for file checks
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallery.nim b/src/gallery.nim
@@ -199,10 +199,10 @@ proc generateWebsite(sourceDir: string, targetDir: string, album: Album, config:
         echo "Generate picture page: " & picture.name
         writeFile(joinPath(targetDir, picture.name & ".html"), render(asset_picture_html, pictureTemplateContext))
 
-        if not fileExists(targetDir & "/thumbnails/" & picture.name & ".png"):
+        if not fileExists(joinPath(targetDir, "thumbnails", picture.name & ".png")):
             smallThumbnails.add("/usr/bin/env mogrify -strip -quality " & $config["ThumbThumbQuality"].getInt & " -format png -path " & quoteShell(joinPath(targetDir, "thumbnails")) & " -thumbnail " & $config["ThumbThumbMaxWidth"].getInt & "x" & $config["ThumbThumbMaxHeight"].getInt & "^ -gravity center -extent " & $config["ThumbThumbMaxWidth"].getInt & "x" & $config["ThumbThumbMaxHeight"].getInt & " " & quoteShell(joinPath(picture.path, picture.filename)))
 
-        if not fileExists(targetDir & "/medium/" & picture.name & ".jpg"):
+        if not fileExists(joinPath(targetDir, "medium", picture.name & "." & picture.filetype)):
             mediumThumbnails.add("/usr/bin/env mogrify -format " & picture.filetype & " -path " & quoteShell(joinPath(targetDir, "medium")) & " -resize " & $config["ThumbMediumMaxWidth"].getInt & "x\\> " & quoteShell(joinPath(picture.path, picture.filename)))
 
         templateContext["pictures"].add(%* {