Verified Commit f96e64c7 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Remove the akonadi-prefix.h file

The values there were used as a fallback in StandardDirs but I suspect
that Akonadi wouldn't be usable anyway without correctly set environment
variables that QStandardPaths need.
parent ca4601f2
......@@ -278,7 +278,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_ENABLE_EXCEPTIONS}")
############### Configure files #############
configure_file(akonadi-prefix.h.cmake ${Akonadi_BINARY_DIR}/akonadi-prefix.h)
configure_file(config-akonadi.h.cmake ${Akonadi_BINARY_DIR}/config-akonadi.h)
############### build targets ###############
......
/* This file contains all the paths that change when changing the installation prefix */
#define AKONADIPREFIX "${CMAKE_INSTALL_PREFIX}"
#define AKONADIDATA "${SHARE_INSTALL_PREFIX}"
#define AKONADICONFIG "${CONFIG_INSTALL_DIR}"
#define AKONADILIB "${LIB_INSTALL_DIR}"
#define AKONADIBUNDLEPATH "${AKONADI_BUNDLE_PATH}"
......@@ -20,7 +20,6 @@
#include "standarddirs_p.h"
#include "instance_p.h"
#include "akonadi-prefix.h"
#include "akonadiprivate_debug.h"
#include <QCoreApplication>
......@@ -143,17 +142,14 @@ QString StandardDirs::locateResourceFile(const char *resource, const QString &re
const QString fullRelPath = buildFullRelPath(resource, relPath);
QVector<QStandardPaths::StandardLocation> userLocations;
QStandardPaths::StandardLocation genericLocation;
QString fallback;
if (qstrncmp(resource, "config", 6) == 0) {
userLocations = { QStandardPaths::AppConfigLocation,
QStandardPaths::ConfigLocation };
genericLocation = QStandardPaths::GenericConfigLocation;
fallback = QDir::toNativeSeparators(QStringLiteral(AKONADIPREFIX "/" AKONADICONFIG));
} else if (qstrncmp(resource, "data", 4) == 0) {
userLocations = { QStandardPaths::AppLocalDataLocation,
QStandardPaths::AppDataLocation };
genericLocation = QStandardPaths::GenericDataLocation;
fallback = QDir::toNativeSeparators(QStringLiteral(AKONADIPREFIX "/" AKONADIDATA));
} else {
qt_assert_x(__FUNCTION__, "Invalid resource type", __FILE__, __LINE__);
return {};
......@@ -190,26 +186,13 @@ QString StandardDirs::locateResourceFile(const char *resource, const QString &re
return path;
}
QFile f(fallback + QStringLiteral("/akonadi/") + relPath);
if (f.exists()) {
return f.fileName();
}
return {};
}
QStringList StandardDirs::locateAllResourceDirs(const QString &relPath)
{
auto dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, relPath,
QStandardPaths::LocateDirectory);
const auto fallback = QDir::toNativeSeparators(QStringLiteral(AKONADIPREFIX "/" AKONADIDATA "/") + relPath);
if (!dirs.contains(fallback)) {
if (QDir::root().exists(fallback)) {
dirs.push_back(fallback);
}
}
return dirs;
return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, relPath,
QStandardPaths::LocateDirectory);
}
QString StandardDirs::findExecutable(const QString &executableName)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment