resurrecting-open-source-projects / scrot

SCReenshOT - command line screen capture utility
Other
511 stars 51 forks source link

optionsNameThumbnail: fix edge case detecting extension #265

Closed N-R-K closed 1 year ago

N-R-K commented 1 year ago

if the filename ends with a dot (eg. "file.") it should not be taken as an extension.

guijan commented 1 year ago

But if you do that it will create a file called file.-thumb and -thumb becomes an extension.

N-R-K commented 1 year ago

But if you do that it will create a file called file.-thumb and -thumb becomes an extension.

What's the benefit of file-thumb. over file.-thumb ? Proper image viewers shouldn't care about extensions. Perhaps some scripts that does extension based heuristics would break, but it'd most likely break on no extension filename ("file.") as well.

I've thought about adding thumb- as a prefix instead of adding it before the extension, but that will break sorted listing:

# current
$ ls
a.png
a-thumb.png
# other stuff..

# with "thumb-" prefix
$ ls
a.png
# other stuff...
thumb-a.png
guijan commented 1 year ago

Windows Explorer displays files without the extension by default, so the user would see 2 files named file. with the default configuration. Although scrot on Windows is largely there to give us more confidence scrot is portable and possibly catch bugs at the moment, I've never actually used it there to see how it works.

We should treat a trailing dot as a sort of null extension when manipulating the string and as no extension when setting the file format.

This is really fixing a non-issue...

N-R-K commented 1 year ago

Both the alternative seems whaky for one reason or another, so I'll just leave it at it's current behavior.