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