[KDE/Mac] QStandardPaths possible solution

René J.V. Bertin rjvbertin at gmail.com
Fri Jan 9 00:52:39 UTC 2015


On Thursday January 08 2015 16:48:46 Jeremy Whiting wrote:

I just installed my brandspankingnew qt5-mac concurrent alongside my ditto qt4-mac. A priori the QSP patch is included, but qtdiag prints

> Library info:
>   PrefixPath: /opt/local/libexec/qt5
>   DocumentationPath: /opt/local/share/doc/qt5
>   HeadersPath: /opt/local/include/qt5
>   LibrariesPath: /opt/local/libexec/qt5/Library/Frameworks
>   LibraryExecutablesPath: /opt/local/libexec/qt5/libexec
>   BinariesPath: /opt/local/libexec/qt5/bin
>   PluginsPath: /opt/local/share/qt5/plugins
>   ImportsPath: /opt/local/share/qt5/imports
>   Qml2ImportsPath: /opt/local/share/qt5/qml
>   ArchDataPath: /opt/local/libexec/qt5
>   DataPath: /opt/local/share/qt5
>   TranslationsPath: /opt/local/share/qt5/translations
>   ExamplesPath: /opt/local/share/qt5/examples
>   TestsPath: /opt/local/share/qt5/tests
> 
> Standard paths [*...* denote writable entry]:
>   DesktopLocation: "Desktop" */Users/bertin/Desktop*
>   DocumentsLocation: "Documents" */Users/bertin/Documents*
>   FontsLocation: "Fonts" */System/Library/Fonts*
>   ApplicationsLocation: "Applications" */Applications*
>   MusicLocation: "Music" */Users/bertin/Music*
>   MoviesLocation: "Movies" */Users/bertin/Movies*
>   PicturesLocation: "Pictures" */Users/bertin/Pictures*
>   TempLocation: "TemporaryItems"
>   */var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T* HomeLocation: "Home"
>   */Users/bertin*
>   DataLocation: "Application Support" */Users/bertin/Library/Application
>   Support/Qt Project/qtdiag* /Library/Application Support/Qt Project/qtdiag
>   /opt/local/share/Qt Project/qtdiag /Library/Application Support/Qt
>   Project/qtdiag /opt/local/libexec/qt5/bin/ CacheLocation: "Caches"
>   */Users/bertin/Library/Caches/Qt Project/qtdiag* /Library/Caches/Qt
>   Project/qtdiag GenericDataLocation: "Application Support"
>   */Users/bertin/Library/Application Support* /Library/Application Support
>   /opt/local/share /Library/Application Support RuntimeLocation:
>   "Application Support" */Users/bertin/Library/Application Support*
>   ConfigLocation: "Preferences" */Users/bertin/Library/Preferences*
>   DownloadLocation: "Documents" */Users/bertin/Documents*
>   GenericCacheLocation: "Caches" */Users/bertin/Library/Caches*
>   /Library/Caches
>   GenericConfigLocation: "Preferences" */Users/bertin/Library/Preferences*

That reeks that the patch doesn't do anything. I wonder, looking at the code:

QStringList QStandardPaths::standardLocations(StandardLocation type)
{
    QStringList dirs;

    if (type == GenericDataLocation || type == DataLocation || type == GenericCacheLocation || type == CacheLocation) {
        const QString path = macLocation(type, kOnAppropriateDisk);
        if (!path.isEmpty())
            dirs.append(path);
    }

    if (type == GenericDataLocation) {
        dirs.append(xdgDataDirs());
    }

    if (type == DataLocation) {
        QStringList xdgDirs = xdgDataDirs();
        for (int i = 0; i < xdgDirs.count(); ++i) {
            appendOrganizationAndApp(xdgDirs[i]);
        }
        dirs.append(xdgDirs);

        CFBundleRef mainBundle = CFBundleGetMainBundle();
        if (mainBundle) {

I'm tempted to say that the 1st, conditional invocation of xdgDataDirs() should come *before* the call to macLocation(), no?

Also, side-ways related: why does Qt only look in /System/Library/Fonts, and not first in /Library/Fonts as the OS does?

R.


More information about the kde-mac mailing list