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:
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;