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
This commit is contained in:
Bill Kendrick 2023-05-27 11:55:55 -07:00
parent 7b6f04ac1d
commit 10092ece0e

View file

@ -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