Skip to content

fix autoincrement of %d for templates with subdirs

in case the filename to save a screenshot to contains subdirectories, the auto-increment of any %d placeholders was broken.

For a template of %Y/%M/screen-%d and %Y/%M/screen-1.png already existing this now results in %Y/%M/screen-2.png being created instead of %Y/%M/screen-1-1.png.

More detailed description:

Let the save location be $HOME/screenshots and the filename template be %Y/%M/screen-%d.

Spectacle before this commit would search $HOME/screenshots for files matching 2020\\/11\\/screen\\-(\\d{1,}), which would always fail to match any file since only files directly contained in $HOME/screenshots will be searched and not any files from its subdirectories.

This commit changes this, so Spectacle will search $HOME/screenshots/%Y/%M/ for files matching screen\\-(\\d{1,}) which will produce the expected results.

I've tested this for filename templates without subdirectories, too, to be sure this didn't regress that case.

Edited by Franz Baumgärtner

Merge request reports