Alkimia API

alkenvironment.h
1/*
2 SPDX-FileCopyrightText: 2023 Thomas Baumgart tbaumgart @kde.org
3
4 This file is part of libalkimia.
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef ALKENVIRONMENT_H
10#define ALKENVIRONMENT_H
11
12#include <alkimia/alk_export.h>
13
14class QProcess;
15
16class ALK_EXPORT AlkEnvironment
17{
18public:
19 /**
20 * Check if @a applicationPath (usually argv[0]) is pointing to an application
21 * inside an AppImage container and setting up certain environment variables
22 *
23 * For AppImages we need to set the LD_LIBRARY_PATH to have
24 * $APPDIR/usr/lib/ as the first entry. We set this up here.
25 * For security reasons, we extract the directory from argv[0]
26 * and don't use APPDIR directly. It would otherwise allow to
27 * add a different library path for non AppImage versions.
28 *
29 * Has no function if not running inside AppImage container or
30 * Q_OS_UNIX is not defined
31 */
32 static void checkForAppImageEnvironment(const char* applicationPath);
33
34 /**
35 * Check if the current application is running inside an AppImage
36 * container.
37 *
38 * @return true Running inside AppImage container
39 * @return false otherwise
40 *
41 * @note Requires checkForAppImageEnvironment() to be run before
42 */
43 static bool isRunningAsAppImage();
44
45 /**
46 * Adjust the LD_LIBRARY_PATH environment variable to exclude
47 * the AppImage mount point so that external tools do not try
48 * to use libs contained inside the AppImage for the @a process
49 * pointed to by the argument.
50 *
51 * Has no function if not running inside AppImage container,
52 * Q_OS_UNIX is not defined or @a process is @c nullptr
53 *
54 * @note Requires checkForAppImageEnvironment() to be run before
55 */
56 static void removeAppImagePathFromLinkLoaderLibPath(QProcess* process);
57};
58#endif // ALKENVIRONMENT_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.