File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
dpso_ocr/engine/tesseract Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#include < algorithm>
4
4
#include < cstring>
5
+ #include < filesystem>
5
6
#include < initializer_list>
6
7
7
8
#include < tesseract/baseapi.h>
@@ -69,7 +70,17 @@ std::vector<std::string> getAvailableLangs(const char* dataDir)
69
70
70
71
#if TESSERACT_MAJOR_VERSION >= 5
71
72
72
- tess.GetAvailableLanguagesAsVector (&result);
73
+ // In Tesseract 5.5.0, GetAvailableLanguagesAsVector() was
74
+ // rewritten to use std::filesystem, but due to the lack of any
75
+ // exception handling, the method leaks filesystem_error (e.g. if
76
+ // the directory does not exist).
77
+ //
78
+ // See https://github.com/tesseract-ocr/tesseract/issues/4364
79
+ try {
80
+ tess.GetAvailableLanguagesAsVector (&result);
81
+ } catch (std::filesystem::filesystem_error&) {
82
+ return result;
83
+ }
73
84
74
85
result.erase (
75
86
std::remove_if (
Original file line number Diff line number Diff line change 1
1
#include " init_user_data.h"
2
2
3
3
#include < filesystem>
4
- #include < system_error>
5
4
6
5
#include " dpso_utils/error_get.h"
7
6
#include " dpso_utils/error_set.h"
Original file line number Diff line number Diff line change @@ -100,4 +100,3 @@ void testByteOrder()
100
100
101
101
102
102
REGISTER_TEST (testByteOrder);
103
-
You can’t perform that action at this time.
0 commit comments