Skip to content

Commit d8b6d55

Browse files
committed
fix: Issue #1162 TESSDATA_PREFIX requires path separator at its end
1 parent 9e2a594 commit d8b6d55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib_ccx/ocr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ static int search_language_pack(const char *dir_name, const char *lang_name)
5151

5252
// Search for a tessdata folder in the specified directory
5353
char *dirname = strdup(dir_name);
54-
dirname = realloc(dirname, strlen(dirname) + strlen("tessdata/") + 1);
54+
dirname = realloc(dirname, strlen(dirname) + strlen("tessdata/") + (dirname[strlen(dirname) - 1] != '/') + 1);
55+
if (dirname[strlen(dirname) - 1] != '/')
56+
strcat(dirname, "/");
5557
strcat(dirname, "tessdata/");
5658

5759
DIR *dp;

0 commit comments

Comments
 (0)