mkdir exportdir's parent, if necessary

Tux Paint's export features will fail if the parent
of the export directory didn't exist.  e.g., using the
default (either via XDG or hard-coded fallback) of
"~/Pictures/TuxPaint/", Tux Paint could not export if
"~/Pictures/" didn't exist yet.  It will now try to
mkdir it as well.  h/t Tim Dickson

Updated OPTIONS documents to explain this.

Also, documenting --exportdir in manpage (was missing!)
This commit is contained in:
Bill Kendrick 2021-01-13 22:48:29 -08:00
parent c2a4b9862a
commit c97932606f
9 changed files with 74 additions and 20 deletions

View file

@ -25963,9 +25963,16 @@ static char * get_export_filepath(const char * ext) {
/* Make sure the export dir exists */
if (!make_directory(DIR_EXPORT, "", "Can't create export directory (E016)"))
if (!make_directory(DIR_EXPORT, "", "Can't create export directory; will try to make its parent (E016)"))
{
return NULL;
/* See if perhaps we need to try and make its parent directory first? */
if (make_directory(DIR_EXPORT_PARENT, "", "Can't create export directory parent (E016b)")) {
if (!make_directory(DIR_EXPORT, "", "Can't create export directory (E016c)")) {
return NULL;
}
} else {
return NULL;
}
}
/* Create a unique filename, within that dir */