[KDE/Mac] Thoughts on standard directories in Qt5 - QStandardPaths
Marko Käning
mk-lists at email.de
Sat Dec 6 19:22:51 UTC 2014
I just stumbled over this interesting post from David from August, which shows
nicely how qtpaths can be used to locate files.
Begin forwarded message:
> From: David Faure <faure at kde.org>
> Subject: Re: Suggestion to ntroduce an application for testing config paths and access to files installed by cmake or created at runtime
> Date: 22 Aug 2014 09:35:17 GMT+2
> To: Marko Käning <mk-lists at email.de>
> Cc: kde-frameworks-devel at kde.org
>
> On Friday 22 August 2014 09:21:13 Marko Käning wrote:
>> 1) files installed by cmake indeed land where the application expects them
>> at runtime
>
> You can write a script that checks that, using the "qtpaths" executable.
>
> For instance xmlgui says
>
> kxmlguiclient.cpp:199: const QString file = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("ui/ui_standards.rc"));
>
> so the script can check that with
>
> qtpaths --locate-file ConfigLocation ui/ui_standards.rc
>
> which returns this, for me:
>
> /d/kde/inst/kde_frameworks/etc/xdg/ui/ui_standards.rc
>
> (technically it should be GenericConfigLocation but it's the same on Unix and GenericConfigLocation was only added recently to qtpaths).
>
>
> Another example, knotifications looks up .knotifyrc files using
> ./src/knotifyconfig.cpp:62: eventsfile = retrieve_from_cache(QStringLiteral("knotifications5/") + _appname + QStringLiteral(".notifyrc"), QStandardPaths::GenericDataLocation);
>
> and kwallet installs its notifyrc file into
>
> PREFIX/share/knotifications5/kwalletd.notifyrc
>
> so we can find out if this file is going to be found by using
>
> qtpaths --locate-file GenericDataLocation knotifications5/kwalletd.notifyrc
>
> which works on my system too.
>
> But doing this for each and every file is a huge amount of work, I'm stopping here. Feel free to take over, now that you know how.
>
> --
> David Faure, faure at kde.org, http://www.davidfaure.fr
> Working on KDE Frameworks 5
>
Which reveals for our case:
---
$ XDG_CONFIG_HOME=/opt/kde/install/darwin/mavericks/clang/kf5-qt5/frameworks/kxmlgui/inst/etc/xdg XDG_DATA_HOME=/opt/kde/install/darwin/mavericks/clang/kf5-qt5/kde/kdegames/bovo/inst/share /opt/kde/install/darwin/mavericks/clang/kf5-qt5/qt5/inst/bin/qtpaths --locate-file ConfigLocation ui/ui_standards.rc
/opt/kde/install/darwin/mavericks/clang/kf5-qt5/frameworks/kxmlgui/inst/etc/xdg/ui/ui_standards.rc
$ XDG_CONFIG_HOME=/opt/kde/install/darwin/mavericks/clang/kf5-qt5/frameworks/kxmlgui/inst/etc/xdg XDG_DATA_HOME=/opt/kde/install/darwin/mavericks/clang/kf5-qt5/kde/kdegames/bovo/inst/share /opt/kde/install/darwin/mavericks/clang/kf5-qt5/qt5/inst/bin/qtpaths --locate-file GenericDataLocation themes
---
that indeed the folder “themes" cannot be found like this.
More information about the kde-mac
mailing list