Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit da38011

Browse files
LNJjbruechert
authored andcommitted
getResourcePath: Add binary relative paths
Fixes #141.
1 parent 1bde730 commit da38011

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Kaidan.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <QString>
3030
#include <QStandardPaths>
3131
#include <QTimer>
32+
#include <QCoreApplication>
3233
// gloox
3334
#include <gloox/rostermanager.h>
3435
#include <gloox/receipt.h>
@@ -281,8 +282,13 @@ void Kaidan::removeContact(QString jid)
281282

282283
QString Kaidan::getResourcePath(QString name_)
283284
{
285+
// list of file paths where to search for the resource file
286+
QStringList pathList;
287+
// add relative path from binary (only works if installed)
288+
pathList << QCoreApplication::applicationDirPath() + QString("/../share/") + QString(APPLICATION_NAME);
284289
// get the standard app data locations for current platform
285-
QStringList pathList = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
290+
pathList << QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
291+
// add build directory
286292
pathList << QString(DEBUG_SOURCE_PATH) + QString("/data"); // append debug directory
287293

288294
// search for file in directories

0 commit comments

Comments
 (0)