Ensure {datadir}/templates exists when making template
Example mkdir /tmp/tp tuxpaint --datadir /tmp/tp without this fix, choosing "Template" (make a new templat) from "Open" dialog would result in an error, since `/tmp/tp/templates` did not exist. We now `mkdir()` it. This requires, of course, that the directory specified by `--datadir` _itself_ exists. (We will not attempt to create anything higher up.)
This commit is contained in:
parent
c359216180
commit
269355a99c
1 changed files with 5 additions and 0 deletions
|
|
@ -31288,6 +31288,11 @@ static int export_pict(char *fname, int where)
|
|||
int len = (strlen(dir) + 64);
|
||||
char timestamp[16];
|
||||
|
||||
if (!make_directory(DIR_DATA, "templates", "Can't create 'templates' directory in specified datadir"))
|
||||
{
|
||||
return(SDL_FALSE);
|
||||
}
|
||||
|
||||
/* Create a unique filename, within that dir */
|
||||
t = time(NULL);
|
||||
strftime(timestamp, sizeof(timestamp), "%Y%m%d%H%M%S", localtime(&t));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue