Config: Look for exclude file in a relative path.

If the application binary is not installed in /usr/bin the client
with this patch considers to check the relative location
../../etc/owncloud-client/ to find the system exclude.

This is an important bit for AppImage based packages of the client,
as this runs from a temporar mountpoint and the system file can not
be found under /etc.
This commit is contained in:
Klaas Freitag 2017-11-22 19:10:37 +01:00 коммит произвёл ckamm
Родитель 4dc49ff3b0
Коммит 3b96097cf6
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -306,6 +306,19 @@ QString ConfigFile::excludeFileFromSystem()
QFileInfo nextToBinary(QCoreApplication::applicationDirPath(), exclFile);
if (nextToBinary.exists()) {
fi = nextToBinary;
} else {
// For AppImage, the file might reside under a temporary mount path
QDir d(QCoreApplication::applicationDirPath()); // supposed to be /tmp/mount.xyz/usr/bin
d.cdUp(); // go out of bin
d.cdUp(); // go out of usr
if (!d.isRoot()) { // it is really a mountpoint
if (d.cd("etc") && d.cd(Theme::instance()->appName())) {
QFileInfo inMountDir(d, exclFile);
if (inMountDir.exists()) {
fi = inMountDir;
}
};
}
}
}
#endif