Description
Current Behavior
$ LANG=en ls /usr/share/tessdata
ls: cannot access '/usr/share/tessdata': No such file or directory
#8 0x00007ffff7aad57b in std::filesystem::__cxx11::recursive_directory_iterator::recursive_directory_iterator
(this=0x7fffffffc2b0, __p=filesystem::path "/usr/share/tessdata/" = {...}, __options=(std::filesystem::directory_options::follow_directory_symlink | std::filesystem::directory_options::skip_permission_denied))
at /usr/include/c++/14/bits/fs_dir.h:514
#9 tesseract::addAvailableLanguages (datadir="/usr/share/tessdata/", langs=langs@entry=0x7fffffffc620) at src/api/baseapi.cpp:152
#10 0x00007ffff7aae2d0 in tesseract::TessBaseAPI::GetAvailableLanguagesAsVector (this=this@entry=0x7fffdc0021d8, langs=langs@entry=0x7fffffffc620) at src/api/baseapi.cpp:399
Expected Behavior
It doesn't crash.
Suggested Fix
https://github.com/tesseract-ocr/tesseract/blob/main/src/api/baseapi.cpp#L149:
Add check here whether path/file exists and return if not.
tesseract -v
No response
Operating System
No response
Other Operating System
No response
uname -a
No response
Compiler
No response
CPU
No response
Virtualization / Containers
No response
Other Information
No response