From 4f654a215d5bc8bd0b366e566b64cb17cd82b22a Mon Sep 17 00:00:00 2001 From: rudera-byte Date: Fri, 14 Mar 2025 01:09:58 +0530 Subject: [PATCH] fix: Issue #1162 TESSDATA_PREFIX requires path separator at its end --- src/lib_ccx/ocr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c index 263932cf9..a5afc88bc 100644 --- a/src/lib_ccx/ocr.c +++ b/src/lib_ccx/ocr.c @@ -50,7 +50,9 @@ static int search_language_pack(const char *dir_name, const char *lang_name) // Search for a tessdata folder in the specified directory char *dirname = strdup(dir_name); - dirname = realloc(dirname, strlen(dirname) + strlen("tessdata/") + 1); + dirname = realloc(dirname, strlen(dirname) + strlen("tessdata/") + (dirname[strlen(dirname) - 1] != '/') + 1); + if (dirname[strlen(dirname) - 1] != '/') + strcat(dirname, "/"); strcat(dirname, "tessdata/"); DIR *dp;