Skip to content

Commit

Permalink
Fixed Tessdata directory for Windows
Browse files Browse the repository at this point in the history
The old code ignored the drive letter for the tessdata directory path.

Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
  • Loading branch information
noahmetzger committed Apr 11, 2018
1 parent 4b50f3f commit b7b6b28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ccutil/mainblk.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit b7b6b28

Please sign in to comment.