Plasma distro-specific installation path?

Michail Vourlakos mvourlakos at gmail.com
Tue Mar 19 12:05:28 GMT 2019


I am trying to find a way to access some application data. Examples are,
plasma desktopthemes and kwin colorschemes...

In the future this will also be needed because Latte will provide
installable qml indicators (something like plasma qml applets currently
do but these are going to be used only to draw the task/applet
activeORstate indicator

what I did is the following:

///////////////////////////////
//! returns the standard path found that contains the subPath
//! local paths have higher priority by default
QString Importer::standardPath(QString subPath, bool localfirst)
{
    QStringList paths =
QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);

    if (localfirst) {
        foreach (auto pt, paths) {
            QString ptF = pt + "/" +subPath;
            if (QFileInfo(ptF).exists()) {
                return ptF;
            }
        }
    } else {
        for (int i=paths.count()-1; i>=0; i--) {
            QString ptF = paths[i] + "/" +subPath;
            if (QFileInfo(ptF).exists()) {
                return ptF;
            }
        }
    }

    //! in any case that above fails
    if (QFileInfo("/usr/share/"+subPath).exists()) {
        return "/usr/share/"+subPath;
    }

    return "";
}

///////////////////////////////////

In my code I can use it for example as:
Importer::standardPath("color-schemes");

OR if I know the name I am searching
Importer::standardPath("color-schemes/" + schemeName + ".colors");


BUT I dont think this approach works when user has installed Plasma on its
local directory and how that directory can be KNOWN.

regards,
michail


Στις Τρί, 19 Μαρ 2019 στις 11:34 π.μ., ο/η David Edmundson <
david at davidedmundson.co.uk> έγραψε:

> Can you elaborate on what you're trying to accomplish?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190319/9d63c0c4/attachment.html>


More information about the Plasma-devel mailing list