[plasma/union] src: Add a method to PlatformPlugin that returns the install path for packages

Arjen Hiemstra <[email protected]> Wed, 5 Aug 2026 10:33:24 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 7731ff0ccd629ecc1a8b7ffa5abbb0d11a8e55ea by Arjen Hiemstra.
Committed on 05/08/2026 at 10:24.
Pushed by ahiemstra into branch 'master'.

Add a method to PlatformPlugin that returns the install path for packages

M  +5    -0    src/PlatformPlugin.cpp
M  +8    -0    src/PlatformPlugin.h

https://invent.kde.org/plasma/union/-/commit/7731ff0ccd629ecc1a8b7ffa5abbb0d11a8e55ea

diff --git a/src/PlatformPlugin.cpp b/src/PlatformPlugin.cpp
index 4da806f6..d8343244 100644
--- a/src/PlatformPlugin.cpp
+++ b/src/PlatformPlugin.cpp
@@ -24,6 +24,11 @@ QList<std::filesystem::path> Union::PlatformPlugin::stylePackagePaths()
     return result;
 }
 
+std::filesystem::path Union::PlatformPlugin::stylePackageInstallPath()
+{
+    return std::filesystem::path(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation).toStdString()) / "union" / "styles";
+}
+
 QIcon PlatformPlugin::platformIcon(const QString &name, [[maybe_unused]] const QColor &color)
 {
     return QIcon::fromTheme(name);
diff --git a/src/PlatformPlugin.h b/src/PlatformPlugin.h
index 3ec6cf15..d5a2d082 100644
--- a/src/PlatformPlugin.h
+++ b/src/PlatformPlugin.h
@@ -38,6 +38,14 @@ public:
      * should the platform have a location that is not handled by QStandardPaths.
      */
     virtual QList<std::filesystem::path> stylePackagePaths();
+    /*!
+     * Returns the path where new styles should be installed to.
+     *
+     * By default this will use QStandardPaths and return the writable path for
+     * GenericDataLocation with "union/styles" appended. This can be overridden
+     * by a platform if styles should be written to a different location.
+     */
+    virtual std::filesystem::path stylePackageInstallPath();
     /*!
      * Returns an icon from the platform.
      *