Skip to content

Commit

Permalink
getResourcePath: Add binary relative paths
Browse files Browse the repository at this point in the history
Fixes #141.
  • Loading branch information
LNJ authored and jbruechert committed Nov 25, 2017
1 parent 1bde730 commit da38011
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Kaidan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QString>
#include <QStandardPaths>
#include <QTimer>
#include <QCoreApplication>
// gloox
#include <gloox/rostermanager.h>
#include <gloox/receipt.h>
Expand Down Expand Up @@ -281,8 +282,13 @@ void Kaidan::removeContact(QString jid)

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

// search for file in directories
Expand Down

0 comments on commit da38011

Please sign in to comment.