KLibexec Namespace

Utility functions around libexec. More...

Header: #include <KLibexec>
CMake: find_package(KF6 REQUIRED COMPONENTS CoreAddons)
target_link_libraries(mytarget PRIVATE KF6::CoreAddons)

Functions

(since 5.91) QStringList kdeFrameworksPaths(const QString &relativePath)
(since 5.91) QString path(const QString &relativePath)

Detailed Description

Function Documentation

[since 5.91] QStringList KLibexec::kdeFrameworksPaths(const QString &relativePath)

default paths list for KDE Frameworks

This function returns a fairly opinionated list of paths you can feed into QStandardPaths. The list includes various standard locations for Qt and KDE Frameworks and should generally be sensible for most use cases. You may wish to append the absolute installation path as final fallback.

Warning: The precise content and order of the list is an implementation detail and not expected to remain stable!

relativePath see path() - not all paths get this appended!

Returns QStringList list of search paths

This function was introduced in 5.91.

[since 5.91] QString KLibexec::path(const QString &relativePath)

Absolute libexec path resolved in relative relation to the current shared object.

This function helps locate the absolute libexec path relative to the caller's binary artifact.

For example:

- Your source gets built with prefix /usr - Your binary artifact's presumed absolute path will be `/usr/lib/libfoobar.so` - You call `KLibexec::path("libexec/foobar")`

Scenario 1 - The binaries are actually installed in /usr: - The function's output is `/usr/lib/libexec/foobar/` (resolved relatively from `/usr/lib/libfoobar.so`)

Scenario 2 - The **same** binaries are installed in /opt (or moved there): - The function's output is `/opt/lib/libexec/foobar/` (resolved relatively from `/opt/lib/libfoobar.so`)

relativePath relative element to append (e.g. "libexec/foobar" resulting in /usr/lib/libexec/foobar/ as output) when called with an empty string you effectively get the directory of your binary artifact.

Returns QString absolute libexec path or empty string if it cannot be resolved

This function was introduced in 5.91.