mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-22 09:53:03 +08:00
Update ccutil.cpp (#3768)
Fixes #3767. Co-authored-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
9f278588eb
commit
e9b3939566
@ -63,21 +63,24 @@ void CCUtil::main_setup(const std::string &argv0, const std::string &basename) {
|
||||
char *separator = std::strrchr(path, '\\');
|
||||
if (separator != nullptr) {
|
||||
*separator = '\0';
|
||||
datadir = path;
|
||||
datadir += "/tessdata";
|
||||
std::string subdir = path;
|
||||
subdir += "/tessdata";
|
||||
if (_access(subdir.c_str(), 0) == 0) {
|
||||
datadir = subdir;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
#if defined(TESSDATA_PREFIX)
|
||||
} else {
|
||||
// Use tessdata prefix which was compiled in.
|
||||
datadir = TESSDATA_PREFIX "/tessdata";
|
||||
#endif
|
||||
}
|
||||
|
||||
// datadir may still be empty:
|
||||
if (datadir.empty()) {
|
||||
#if defined(TESSDATA_PREFIX)
|
||||
// Use tessdata prefix which was compiled in.
|
||||
datadir = TESSDATA_PREFIX "/tessdata";
|
||||
#else
|
||||
datadir = "./";
|
||||
#endif /* TESSDATA_PREFIX */
|
||||
}
|
||||
|
||||
// check for missing directory separator
|
||||
|
Loading…
Reference in New Issue
Block a user