Debian Codegraph @

online-accounts-plugins/lib/module/config.hpp.in

raw
1 /*
2 * Copyright (C) 2024 UBports Foundation
3 *
4 * This file is part of OnlineAccountsPlugin.
5 *
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This softwareis distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with OnlineAccountsClient. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __CONFIG_HPP__
22 #define __CONFIG_HPP__
23
24 #include <QCoreApplication>
25 #include <QString>
26
27 static QString SNAP_ENV = qgetenv("SNAP");
28 static QString APP_DIR = qgetenv("APP_DIR");
29
30 inline QString i18nDirectory (void)
31 {
32 if (!SNAP_ENV.isEmpty()) {
33 return SNAP_ENV + QStringLiteral("@CMAKE_INSTALL_FULL_LOCALEDIR@");
34 } else if (!APP_DIR.isEmpty()) {
35 return APP_DIR + QStringLiteral("@CMAKE_INSTALL_FULL_LOCALEDIR@");
36 } else {
37 return QStringLiteral("@CMAKE_INSTALL_FULL_LOCALEDIR@");
38 }
39 }
40
41 #endif // __CONFIG_HPP__