Properly add data root to XDG_DATA_DIRS and only when necessary
Needs ReviewPublic

Authored by sniperrifle on Fri, Nov 29, 12:07 AM.

Details

Reviewers
apol
Summary

This patch ensures the XDG_DATA_DIRS will be properly altered and only when necessary. This implies:

  • If the data root is already in XDG_DATA_DIRS either in the value or in the spec's default value, the value will remain unchanged.
  • If the data root is not in the value yet, it will be prepended, thus given preference over other prefixes containing KDE resources. This is what I believe was the intention of the original code.

Furthermore this restores the proper preference order of the default value.

BUG: 315452

Test Plan

I tested three scenarios by setting XDG_DATA_DIRS in startplasma-dev.sh:

  • Unset and not present. Should result in <dev-data-root>:/usr/local/share:/usr/share
  • Set and present. Should leave value unchanged
  • Set and not present. I tested this by setting it to the default value manually with a bogus diretory in between. Leaving out the default might have led to other problems. Should result in <dev-data-root>:/bogus:/usr/local/share:/usr/share

I did not test the fourth scenario unset and present, since it would have involved installing the dev kde in /usr/local or /usr and I did not want to do that.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Lint Skipped
Unit
Unit Tests Skipped
sniperrifle created this revision.Fri, Nov 29, 12:07 AM
Restricted Application added a project: Plasma. · View Herald TranscriptFri, Nov 29, 12:07 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sniperrifle requested review of this revision.Fri, Nov 29, 12:07 AM
apol requested changes to this revision.Fri, Nov 29, 1:11 AM
apol added a subscriber: apol.
apol added inline comments.
startkde/startplasma.cpp
188–201

Please reduce the amount of comments.
It's hard to read and not very descriptive. We can read the code as well. Instead of writing what it does, explain why if you really think it's necessary. At this point I'd be happy removing the comments overall.

208

Can do with splitRef.

This revision now requires changes to proceed.Fri, Nov 29, 1:11 AM

Condensed the overly verbose comments into a single sentence capturing the essence of the original comments and use splitRef instead of split.

Diff to the proper upstream

I'm thinking of adding what the intended behaviour is of the function regarding XDG_DATA_DIRS to the function comment and removing the comment in the code. Would that be acceptable?