slackbuilds_ponce/graphics/gimagereader/remove_enchant-provider.patch
Matteo Bernardini 30b4d98bfa 20241116.1 global branch merge.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
2024-11-16 14:53:18 +01:00

68 lines
2.2 KiB
Diff

From e72d657a408dc6b77c48c086feede31e08700b4c Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro@gmail.com>
Date: Fri, 14 Jun 2024 00:37:20 +0200
Subject: [PATCH] Work around enchant_get_prefix_dir which is not available
anymore in recent enchant
---
gtk/src/Config.cc | 7 -------
qt/src/Config.cc | 10 ++++++----
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/gtk/src/Config.cc b/gtk/src/Config.cc
index fcec9645..73a68893 100644
--- a/gtk/src/Config.cc
+++ b/gtk/src/Config.cc
@@ -24,7 +24,6 @@
#include "Utils.hh"
#include "OutputEditorText.hh"
-#include <enchant-provider.h>
#define USE_STD_NAMESPACE
#include <tesseract/baseapi.h>
#if TESSERACT_MAJOR_VERSION < 5
@@ -214,13 +213,7 @@ void Config::openSpellingDir() {
std::string Config::spellingLocation(Location location) {
if(location == SystemLocation) {
-#ifdef G_OS_WIN32
std::string dataDir = Glib::build_filename(pkgDir, "share");
-#else
- char* prefix = enchant_get_prefix_dir();
- std::string dataDir = Glib::build_filename(prefix, "share");
- free(prefix);
-#endif
#if HAVE_ENCHANT2
if(Gio::File::create_for_path(Glib::build_filename(dataDir, "myspell"))->query_exists()) {
return Glib::build_filename(dataDir, "myspell");
diff --git a/qt/src/Config.cc b/qt/src/Config.cc
index efc788e2..fb6d2e58 100644
--- a/qt/src/Config.cc
+++ b/qt/src/Config.cc
@@ -25,10 +25,10 @@
#include <QDesktopServices>
#include <QDir>
+#include <QLibraryInfo>
#include <QMultiMap>
#include <QStandardPaths>
#include <QUrl>
-#include <enchant-provider.h>
#define USE_STD_NAMESPACE
#include <tesseract/baseapi.h>
#if TESSERACT_MAJOR_VERSION < 5
@@ -200,9 +200,11 @@ QString Config::spellingLocation(Location location) {
#ifdef Q_OS_WIN
QDir dataDir = QDir(QString("%1/../share/").arg(QApplication::applicationDirPath()));
#else
- char* prefix = enchant_get_prefix_dir();
- QDir dataDir(QDir(prefix).absoluteFilePath("share"));
- free(prefix);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ QDir dataDir = QDir(QString("%1/share/").arg(QLibraryInfo::path(QLibraryInfo::PrefixPath)));
+#else
+ QDir dataDir = QDir(QString("%1/share/").arg(QLibraryInfo::location(QLibraryInfo::PrefixPath)));
+#endif
#endif
#if HAVE_ENCHANT2
if(QDir(dataDir.absoluteFilePath("myspell")).exists()) {