From 7580cd4b39f3ba49431e98794cef6ecd83125f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= Date: Wed, 26 Aug 2026 03:08:47 +0200 Subject: [PATCH] Substitute prefix for tesseract paths Instead of hardcoding /app, substitute with the configured prefix during build. Also substitute the user data dir. --- gradia/backend/ocr.py | 2 +- meson.build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradia/backend/ocr.py b/gradia/backend/ocr.py index 6a45a4e2..c0a973e8 100644 --- a/gradia/backend/ocr.py +++ b/gradia/backend/ocr.py @@ -45,7 +45,7 @@ class OCR: def __init__(self, window=None): self.tesseract_cmd = ocr_tesseract_cmd self.original_tessdata_dir = ocr_original_tessdata - self.user_tessdata_dir = os.path.expanduser(f"~/.var/app/{app_id}/data/tessdata") + self.user_tessdata_dir = os.path.join(GLib.get_user_data_dir(), "tessdata") self.window = window pytesseract.pytesseract.tesseract_cmd = self.tesseract_cmd diff --git a/meson.build b/meson.build index a222c561..e62d35df 100644 --- a/meson.build +++ b/meson.build @@ -62,8 +62,8 @@ else endif # OCR Directories -OCR_TESSERACT_CMD = '/app/bin/tesseract' -OCR_ORIGINAL_TESSDATA_DIR = '/app/share/tessdata' +OCR_TESSERACT_CMD = join_paths(get_option('prefix'), 'bin', 'tesseract') +OCR_ORIGINAL_TESSDATA_DIR = join_paths(get_option('prefix'), 'share', 'tessdata') enable_ocr = get_option('enable-ocr')