mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 15:09:03 +08:00
Fixed Tessdata directory for Windows
The old code ignored the drive letter for the tessdata directory path. Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
This commit is contained in:
parent
4b50f3f46f
commit
b7b6b28ecf
@ -64,12 +64,14 @@ void CCUtil::main_setup(const char *argv0, const char *basename) {
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
} else if (datadir == NULL || access(datadir.string(), 0) != 0) {
|
} else if (datadir == NULL || access(datadir.string(), 0) != 0) {
|
||||||
/* Look for tessdata in directory of executable. */
|
/* Look for tessdata in directory of executable. */
|
||||||
|
static char drive[4];
|
||||||
static char dir[128];
|
static char dir[128];
|
||||||
static char exe[128];
|
static char exe[128];
|
||||||
DWORD length = GetModuleFileName(NULL, exe, sizeof(exe));
|
DWORD length = GetModuleFileName(NULL, exe, sizeof(exe));
|
||||||
if (length > 0 && length < sizeof(exe)) {
|
if (length > 0 && length < sizeof(exe)) {
|
||||||
_splitpath(exe, NULL, dir, NULL, NULL);
|
_splitpath(exe, drive, dir, NULL, NULL);
|
||||||
datadir = dir;
|
datadir = drive;
|
||||||
|
datadir += dir;
|
||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
#if defined(TESSDATA_PREFIX)
|
#if defined(TESSDATA_PREFIX)
|
||||||
|
Loading…
Reference in New Issue
Block a user