Improve opening the screenshots folder for missing config files
ClosedPublic

Authored by rkflx on Feb 15 2018, 9:31 PM.

Details

Summary

If Save As was never used before and the Save button was
showing the Save As action, Spectacle would return Pictures by
default as the last used "Save As" location, while in all other cases it
would be Folder/. The missing / resulted in the filemanager
highlighting the folder only, instead of opening it.

The fix simply makes lastSaveAsLocation() consistently return URLs
with a / at the end.

Test Plan
  • rm ~/.config/spectaclerc
  • Open Spectacle, ToolsOpen Screenshots Folder
  • Observe folder being opened instead of highlighted

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.Feb 15 2018, 9:31 PM
rkflx created this revision.
ngraham accepted this revision.Feb 15 2018, 9:38 PM
ngraham added a subscriber: ngraham.

Huh, interesting corner case. Can confirm original problem as well as that it's fixed with this patch. Thanks!

This revision is now accepted and ready to land.Feb 15 2018, 9:38 PM
rkflx added a comment.Feb 15 2018, 9:41 PM

Huh, interesting corner case.

Actually just a chaotic codebase, sometimes returning QUrl, sometimes QString, sometimes with /, sometimes without… That's why it's so important to review in depth and only commit "nice" code.

This revision was automatically updated to reflect the committed changes.