[balooctl] Normalize include/exclude pathes before using it for the config
ClosedPublic

Authored by bruns on Feb 7 2019, 8:17 PM.

Details

Summary

A directory can be added multiple times to the config by just adding a
trailing slash to it, as the config removes any trailing slashes before
storing it, and the contains(path) will not match.

Normalize the path to the same format as used by the config and use it
for both adding and removing it.

While using it for removal is not necessary, it allows to use both
variants and matches the "add" behavior, where both variants have the
same effect.

Diff Detail

Repository
R293 Baloo
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Feb 7 2019, 8:17 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptFeb 7 2019, 8:17 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Feb 7 2019, 8:17 PM
ngraham added inline comments.Feb 8 2019, 6:36 PM
src/tools/balooctl/configcommand.cpp
43

Does this need to be a while? Why not a regular old if? Are you trying to handle the case where it ends with multiple trailing slashes?

bruns marked an inline comment as done.Feb 8 2019, 11:53 PM
bruns added inline comments.
src/tools/balooctl/configcommand.cpp
43

Exactly

bruns marked an inline comment as done.Feb 8 2019, 11:53 PM
ngraham accepted this revision.Feb 11 2019, 10:25 PM

Whoops, forgot to accept.

This revision is now accepted and ready to land.Feb 11 2019, 10:25 PM
This revision was automatically updated to reflect the committed changes.