termux-packages/x11-packages/libqtxdg/xdgdirs_termux_prefix.patch

41 lines
1.5 KiB
Diff

--- src/src/qtxdg/xdgdirs.cpp 2021-04-16 09:29:21.000000000 +0000
+++ src.mod/src/qtxdg/xdgdirs.cpp 2021-05-12 16:50:56.461844000 +0000
@@ -46,6 +46,8 @@
QLatin1String("Videos")
};
+static const char* TERMUX_PREFIX = "@TERMUX_PREFIX@";
+
// Helper functions prototypes
void fixBashShortcuts(QString &s);
void removeEndingSlash(QString &s);
@@ -108,7 +110,7 @@
const QString home = QFile::decodeName(qgetenv("HOME"));
if (home.isEmpty())
- return QString::fromLatin1("/tmp");
+ return QString::fromLatin1(TERMUX_PREFIX) + QString::fromLatin1("/tmp");
else if (dir == XdgDirs::Desktop)
fallback = QString::fromLatin1("%1/%2").arg(home, QLatin1String("Desktop"));
else
@@ -270,8 +272,8 @@
#endif
if (dirs.isEmpty()) {
- dirs.append(QString::fromLatin1("/usr/local/share"));
- dirs.append(QString::fromLatin1("/usr/share"));
+ dirs.append(QString::fromLatin1(TERMUX_PREFIX) + QString::fromLatin1("/local/share"));
+ dirs.append(QString::fromLatin1(TERMUX_PREFIX) + QString::fromLatin1("/share"));
} else {
QMutableListIterator<QString> it(dirs);
while (it.hasNext()) {
@@ -293,7 +295,7 @@
QStringList dirs;
const QString env = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS"));
if (env.isEmpty())
- dirs.append(QString::fromLatin1("/etc/xdg"));
+ dirs.append(QString::fromLatin1(TERMUX_PREFIX) + QString::fromLatin1("/etc/xdg"));
else
#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
dirs = env.split(QLatin1Char(':'), Qt::SkipEmptyParts);