44 {
47 char *tessdata_prefix = getenv("TESSDATA_PREFIX");
48
49 if (argv0 != nullptr && *argv0 != '\0') {
50
52 } else if (tessdata_prefix) {
53
55#if defined(_WIN32)
57
58 char path[_MAX_PATH];
59 DWORD length = GetModuleFileName(nullptr, path, sizeof(path));
60 if (length > 0 && length < sizeof(path)) {
61 char* separator = std::strrchr(path, '\\');
62 if (separator != nullptr) {
63 *separator = '\0';
66 }
67 }
68#endif
69#if defined(TESSDATA_PREFIX)
70 } else {
71
72#define _STR(a) #a
73#define _XSTR(a) _STR(a)
74 datadir = _XSTR(TESSDATA_PREFIX)
"/tessdata";
75#undef _XSTR
76#undef _STR
77#endif
78 }
79
80
83 }
84
85
88 if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
90}
const char * string() const