[KDE/Mac] Thoughts on standard directories in Qt5 - QStandardPaths

David Faure faure at kde.org
Sat Jan 3 11:00:50 UTC 2015


On Thursday 01 January 2015 15:00:40 René J.V. Bertin wrote:
> On Thursday January 01 2015 14:41:37 David Faure wrote:
> >But if /opt/local is such a common prefix on Mac, maybe we can extend
> >qstandardpaths on mac to know about it...
> 
> It's a common prefix for those who use MacPorts . That doesn't mean that the
> majority of Qt(5) users and developers have MacPorts installed ...
> >So, how about something like the patch below? Can you test it? Should we
> >also honour $XDG_DATA_DIRS and $XDG_CONFIG_DIRS, in case someone sets up
> >MacPorts with a different prefix than /opt/local?
> >
> >http://www.davidfaure.fr/2014/qstandardpaths_mac.mm.diff
> 
> For starters I wouldn't out-comment the reference  to XDG_CONFIG_DIRS but
> apart from that, how would this work out for users who have a Qt5 installed
> through MacPorts (so presumably have stuff in ${prefix}/etc/xdg) 

It's not Qt that puts stuff into ${prefix}/share and ${prefix}/etc/xdg,
it's the apps.

> but also
> versions installed elsewhere ... like embedded in app bundles? Example:
> both VirtualBox and Parallels Desktop are built atop Qt (v4 right now but
> that will change sometime soon I presume). What happens with such an
> application when it is started in presence of a Qt5 MacPorts installation?

I don't see the problem. Either they install stuff into 
${prefix}/share/VirtualBox and they'll be happy that this patch finds it,
or they don't install stuff there and nothing will happen.

> I presume that you envision to override the standard QStandardPaths with
> the information from ${prefix}/etc/xdg when that path exists. 

It's just one more lookup path.

> That'd work
> for the MacPorts install, but I'm not even sure if that'd be desirable for
> pure Qt5 applications installed through MacPorts ... 

I don't understand the distinction here.

> let alone for those other applications should the patch be mainstreamed!

If these apps don't install stuff in ${prefix}/share, they won't be affected.

The point is that there's almost always a subdir of share with the name of the 
app or lib, to avoid conflicts. So a non-MacPorts app who expects to find 
stuff in /Library/MyApp (or whatever the correct path is) will still do that, 
since there won't be a ${prefix}/share/MyApp (so having that added to the 
lookup path will have no effect).

And a MacPorts app, if I understand correctly, does not expect to find stuff 
in /Library but rather in ${prefix}/share, and for that it needs my patch.

Ian wrote:
> Perhaps there could be some way for an XDG-based program, from KDE or
> otherwise, to tell QStandardPaths to setXDGModeEnabled(bool xdgMode).

Well, my initial suggestion was to add support for XDG_* env vars to QSP, we 
could do that *without* a default value of /opt/local (unlike my current 
patch), so that nothing happens unless these vars are set. It would do exactly 
that - not affect non-MacPorts apps. This would indeed be "less intrusive".
But you guys said bad things about environment variables so I was trying to 
look for other ideas :-)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the kde-mac mailing list