From d8b6d55763255f7c9be61d7c699043698b53ee1d 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 1ca0d89b8..3e74b3981 100644 --- a/src/lib_ccx/ocr.c +++ b/src/lib_ccx/ocr.c @@ -51,7 +51,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;