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

David Faure faure at kde.org
Mon Jan 5 12:52:52 UTC 2015


Hi Ian,

Thanks for this concrete suggestion.

> David's patch replaces the value of "dirs", for some cases in the switch()
> statement, with a value derived from calling xdgDataDirs().  The latter
> currently returns a list of one string, namely the constant
> "/opt/local/share", but could easily be modified to return a list based on
> $XDG_DATADIRS or a value based on the MacPorts ${prefix}, as it was at
> build time.

Whooops! I definitely didn't want to replace the list, but to append or 
prepend to it.
Sorry if this created any confusion... this was definitely not my intention.

> My idea is simply to move the *second* hunk of David's patch, in its
> entirety, to insert it at the line following:
> ----------------------------------------------------------------------------
> ------------------------- QStringList
> QStandardPaths::standardLocations(StandardLocation type) {
>         QStringList dirs;

Sounds good.

> The effect of this would be to *prepend* the list from xdgDataDirs() to the
> standard (Apple OS X) list provided by QSP.  So the order of paths for
> directories of the required type would be:
> 
>     1. Local directory (writeable)
>     2. XDG-type directories, based on MacPorts' builds of apps that come
>         from releases by the KDE Community (colloquially called "KDE
>         apps" in the MacPorts world, and in the world at large, I imagine
> [1]). 

And not just apps coming from the KDE community, but any Qt app that install 
stuff into /opt/local/share...

> 3. Standard Apple OS X directories, which *might* be used by Qt-based
> apps that are built by MacPorts but not released by the KDE Community (e.g.
> QGIS) [2].

Plus apps not built by MacPorts, of course.

> I think we should also implement, in the patch, support for *all* XDG-type
> directories AND the corresponding XDG_* environment variables,
> including XDG_*_HOME directories, in either ::standardLocations()
> or ::writableLocation().

OK. You can take that code from qstandardpaths_unix.cpp ;-)

I could update my patch, but I'm coding blind, so it would be much better if 
someone with a Qt build from sources (git) on OS X could finish the patch and 
then submit it to gerrit.

> [2] Installation locations used by apps within MacPorts are determined by
>      MacPorts port developers.  In KDE 4, the developers use the same kind
>      of directory tree as Linux distros and KDE developers do, but based on
>      /opt/local for read-only files.

Surely there are other apps doing that, not just KDE apps?


The only thing I'm wondering about is: this approach will force users to
export XDG_DATA_DIRS=/opt/local/share

This is why I was wondering if this couldn't be the default value, much like 
/usr/local/share:/usr/share is the default value for XDG_DATA_DIRS on 
freedesktop platforms.
It would make sense, if this is the default prefix for MacPorts installs.

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



More information about the kde-mac mailing list