From b7b6b28ecff15030a2c98ea3150be2df0cd526cc Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Wed, 11 Apr 2018 16:57:38 +0200 Subject: [PATCH] Fixed Tessdata directory for Windows The old code ignored the drive letter for the tessdata directory path. Signed-off-by: Noah Metzger --- ccutil/mainblk.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ccutil/mainblk.cpp b/ccutil/mainblk.cpp index f69caa70aa..6824f270b8 100644 --- a/ccutil/mainblk.cpp +++ b/ccutil/mainblk.cpp @@ -64,12 +64,14 @@ void CCUtil::main_setup(const char *argv0, const char *basename) { #if defined(_WIN32) } else if (datadir == NULL || access(datadir.string(), 0) != 0) { /* Look for tessdata in directory of executable. */ + static char drive[4]; static char dir[128]; static char exe[128]; DWORD length = GetModuleFileName(NULL, exe, sizeof(exe)); if (length > 0 && length < sizeof(exe)) { - _splitpath(exe, NULL, dir, NULL, NULL); - datadir = dir; + _splitpath(exe, drive, dir, NULL, NULL); + datadir = drive; + datadir += dir; } #endif /* _WIN32 */ #if defined(TESSDATA_PREFIX)