Create directory when saving the menu file
ClosedPublic

Authored by wbauer on Oct 28 2019, 7:24 AM.

Details

Summary

Commit 0bf70655 ported kmenuedit away from KStandardDirs.
But unlike KStandardDirs, QStandardPaths doesn't guarantee that the target directory actually exists, therefore saving the menu file failed if ~/.config/menus/ wasn't there already.

BUG: 413079

Test Plan

Delete ~/.config/menus/ if it exists, run kmenuedit and create a new entry, click on "Save".
The menu is saved successfully now (~/.config/menus/ is being created), and there's no error message anymore that the file couldn't be written.

Diff Detail

Repository
R103 KMenu Editor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
wbauer created this revision.Oct 28 2019, 7:24 AM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 28 2019, 7:24 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
wbauer requested review of this revision.Oct 28 2019, 7:24 AM
wbauer added a comment.EditedOct 28 2019, 7:26 AM

Alternatively, the directory could also be created in TreeView::TreeView(), but I think this place is more logical (there is no reason to create the directory as long as the menu isn't saved) and it would also work if MenuFile would be used in other places as well, with files in different directories.

dfaure accepted this revision.Oct 28 2019, 8:00 AM

Thanks for the fix!

This revision is now accepted and ready to land.Oct 28 2019, 8:00 AM
This revision was automatically updated to reflect the committed changes.