Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2020-06-04 15:16:47 +0300
committerJonathan White <support@dmapps.us>2020-06-04 17:03:40 +0300
commit6f5e13815c656486b8bd1fb0a0c2b3bcfb06dfd9 (patch)
treecb317956246eb502a7f56e7a5b39d3470939c3b7 /src/core/Resources.cpp
parentc830f85c09573a70a39e401e0c6184312e11efea (diff)
Fix resolving resources when running from build directory
* Copy wordlists to build dir share folder * Change resource path resolution to only test the provided directory, not finding a specific file
Diffstat (limited to 'src/core/Resources.cpp')
-rw-r--r--src/core/Resources.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/Resources.cpp b/src/core/Resources.cpp
index 799475bb1..ad1ff5fa0 100644
--- a/src/core/Resources.cpp
+++ b/src/core/Resources.cpp
@@ -224,19 +224,18 @@ Resources::Resources()
{
const QString appDirPath = QCoreApplication::applicationDirPath();
#if defined(Q_OS_UNIX) && !(defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE))
- testResourceDir(KEEPASSX_DATA_DIR) || testResourceDir(QStringLiteral("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))
- || testResourceDir(QStringLiteral("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR));
+ trySetResourceDir(KEEPASSX_DATA_DIR) || trySetResourceDir(QString("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))
+ || trySetResourceDir(QString("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR));
#elif defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
- testResourceDir(appDirPath + QStringLiteral("/../Resources"));
+ trySetResourceDir(appDirPath + QStringLiteral("/../Resources"));
#elif defined(Q_OS_WIN)
- testResourceDir(appDirPath + QStringLiteral("/share"));
+ trySetResourceDir(appDirPath + QStringLiteral("/share"));
#endif
if (m_dataPath.isEmpty()) {
// Last ditch check if we are running from inside the src or test build directory
- testResourceDir(appDirPath + QStringLiteral("/../../share"))
- || testResourceDir(appDirPath + QStringLiteral("/../share"))
- || testResourceDir(appDirPath + QStringLiteral("/../../../share"));
+ trySetResourceDir(appDirPath + QStringLiteral("/../share"))
+ || trySetResourceDir(appDirPath + QStringLiteral("/../../share"));
}
if (m_dataPath.isEmpty()) {
@@ -244,10 +243,11 @@ Resources::Resources()
}
}
-bool Resources::testResourceDir(const QString& dir)
+bool Resources::trySetResourceDir(const QString& path)
{
- if (QFile::exists(dir + QStringLiteral("/icons/application/256x256/apps/keepassxc.png"))) {
- m_dataPath = QDir::cleanPath(dir);
+ QDir dir(path);
+ if (dir.exists()) {
+ m_dataPath = dir.canonicalPath();
return true;
}
return false;