Skip to content

Commit 4f654a2

Browse files
committed
fix: Issue #1162 TESSDATA_PREFIX requires path separator at its end
1 parent 42d7509 commit 4f654a2

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
@@ -50,7 +50,9 @@ static int search_language_pack(const char *dir_name, const char *lang_name)
5050

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

5658
DIR *dp;

0 commit comments

Comments
 (0)