mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-11 12:43:17 +08:00
Fix function addAvailableLanguages (issue #4416)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
d39177e500
commit
3c1c9460d6
@ -150,10 +150,9 @@ static void addAvailableLanguages(const std::string &datadir,
|
|||||||
std::filesystem::recursive_directory_iterator(datadir,
|
std::filesystem::recursive_directory_iterator(datadir,
|
||||||
std::filesystem::directory_options::follow_directory_symlink |
|
std::filesystem::directory_options::follow_directory_symlink |
|
||||||
std::filesystem::directory_options::skip_permission_denied)) {
|
std::filesystem::directory_options::skip_permission_denied)) {
|
||||||
auto path = entry.path().lexically_relative(datadir).string();
|
auto path = entry.path().lexically_relative(datadir);
|
||||||
auto extPos = path.rfind(".traineddata");
|
if (path.extension() == ".traineddata") {
|
||||||
if (extPos != std::string::npos) {
|
langs->push_back(path.replace_extension("").string());
|
||||||
langs->push_back(path.substr(0, extPos));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user