We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d39177e commit 3c1c946Copy full SHA for 3c1c946
src/api/baseapi.cpp
@@ -150,10 +150,9 @@ static void addAvailableLanguages(const std::string &datadir,
150
std::filesystem::recursive_directory_iterator(datadir,
151
std::filesystem::directory_options::follow_directory_symlink |
152
std::filesystem::directory_options::skip_permission_denied)) {
153
- auto path = entry.path().lexically_relative(datadir).string();
154
- auto extPos = path.rfind(".traineddata");
155
- if (extPos != std::string::npos) {
156
- 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());
157
}
158
159
0 commit comments