From 10092ece0eec47ed2c279bd0c7cb28a122347980 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sat, 27 May 2023 11:55:55 -0700 Subject: [PATCH] Starter/Template thumbnails: use DIR_DATA, not DIR_SAVE Places where we attempt to save thumbnails of starters & templates was trying to `mkdir()` a `.thumbs/` subdirectory in non-existent `starters/` and `templates/` subdirectories of the "savedir" location; should be the "datadir" one. To replicate mkdir -p /tmp/tp/starters cp SOMEFILE.png /tmp/tp/starters tuxpaint --datadir /tmp/tp then click "New"; observer the warning Error: Couldn't save thumbnail of saved image! /tmp/tp/starters/.thumbs/SOMEFILE.png The error that occurred was: No such file or directory --- src/tuxpaint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index b4effe6cc..79e266a14 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22229,12 +22229,12 @@ static int do_new_dialog(void) { /* Make sure we have a ~/.tuxpaint/[starters|templates] directory: */ if (make_directory - (DIR_SAVE, dirname[d_places[num_files]], + (DIR_DATA, dirname[d_places[num_files]], "Can't create user data directory (for starters/templates) (E010)")) { /* (Make sure we have a .../[starters|templates]/.thumbs/ directory:) */ safe_snprintf(fname, sizeof(fname), "%s/.thumbs", dirname[d_places[num_files]]); - make_directory(DIR_SAVE, fname, + make_directory(DIR_DATA, fname, "Can't create user data thumbnail directory (for starters/templates) (E011)"); } } @@ -22331,13 +22331,13 @@ static int do_new_dialog(void) dirname[d_places[num_files]], d_names[num_files]); if (!make_directory - (DIR_SAVE, "starters", + (DIR_DATA, "starters", "Can't create user data directory (for starters) (E012)") - || !make_directory(DIR_SAVE, "templates", + || !make_directory(DIR_DATA, "templates", "Can't create user data directory (for templates) (E013)") - || !make_directory(DIR_SAVE, "starters/.thumbs", + || !make_directory(DIR_DATA, "starters/.thumbs", "Can't create user data directory (for starters) (E014)") - || !make_directory(DIR_SAVE, "templates/.thumbs", + || !make_directory(DIR_DATA, "templates/.thumbs", "Can't create user data directory (for templates) (E015)")) fprintf(stderr, "Cannot save any pictures! SORRY!\n\n"); else