Problem loading templates from overridden 'datadir'

When specifying "datadir", Tux Paint's "New" dialog
was able to present templates found in that directory,
but would attempt to load from whatever the user's
"savedir" was, instead.

h/t Giancarlo Orru for reporting the bug.
This commit is contained in:
Bill Kendrick 2023-05-27 11:51:03 -07:00
parent 955c39c053
commit 7b6f04ac1d
2 changed files with 11 additions and 4 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2023.May.25 (0.9.31) 2023.May.27 (0.9.31)
* New Magic Tools: * New Magic Tools:
---------------- ----------------
* Loops - Draw loop-the-loops. * Loops - Draw loop-the-loops.
@ -57,6 +57,13 @@ https://tuxpaint.org/
for Undo/Redo. for Undo/Redo.
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
* When specifying "datadir", Tux Paint's "New" dialog
was able to present templates found in that directory,
but would attempt to load from whatever the user's
"savedir" was, instead.
h/t Giancarlo Orru for reporting the bug.
Bill Kendrick <bill@newbreedsoftware.com>
* Localization Updates: * Localization Updates:
--------------------- ---------------------
* Russian translaton * Russian translaton

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - May 25, 2023 June 14, 2002 - May 27, 2023
*/ */
#include "platform.h" #include "platform.h"
@ -14057,7 +14057,7 @@ static void load_template(char *img_id)
if (template_personal == 0) if (template_personal == 0)
dirname = strdup(DATA_PREFIX "templates"); dirname = strdup(DATA_PREFIX "templates");
else else
dirname = get_fname("templates", DIR_SAVE); dirname = get_fname("templates", DIR_DATA);
/* Clear them to NULL first: */ /* Clear them to NULL first: */
img_starter = NULL; img_starter = NULL;
@ -16986,7 +16986,7 @@ static int do_open(void)
char *instructions; char *instructions;
int num_left_buttons; int num_left_buttons;
/* FIXME: Support simplification to disable "Template" option -bjk 2023.05.25 */ /* FIXME: Support simplification to disable "Template" (make a template) option -bjk 2023.05.25 */
if (1) { if (1) {
instructions = textdir(gettext_noop("Choose a picture and then click “Open”, “Export”, “Template“, or “Erase”. Click “Slides” to create a slideshow animation or “Back“ to return to your current picture.")); instructions = textdir(gettext_noop("Choose a picture and then click “Open”, “Export”, “Template“, or “Erase”. Click “Slides” to create a slideshow animation or “Back“ to return to your current picture."));
} else { } else {