mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-07 18:02:40 +08:00
Fix usage of tesserr stream
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
1ea0ef29a4
commit
bb9604fbf0
@ -29,6 +29,7 @@
|
||||
#include "params.h"
|
||||
#include "stopper.h"
|
||||
#include "tesseractclass.h"
|
||||
#include "tesserrstream.h" // for tesserr
|
||||
#include "tessvars.h"
|
||||
#include "tprintf.h"
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
@ -86,10 +87,9 @@ bool Tesseract::init_tesseract_lang_data(const std::string &arg0,
|
||||
|
||||
// Initialize TessdataManager.
|
||||
if (!mgr->is_loaded() && !mgr->Init(tessdata_path.string().c_str())) {
|
||||
tprintf("Error opening data file %s\n", tessdata_path.string());
|
||||
tprintf(
|
||||
tesserr << "Error opening data file " << tessdata_path.string() << '\n' <<
|
||||
"Please make sure the TESSDATA_PREFIX environment variable is set"
|
||||
" to your \"tessdata\" directory.\n");
|
||||
" to your \"tessdata\" directory.\n";
|
||||
return false;
|
||||
}
|
||||
#ifdef DISABLED_LEGACY_ENGINE
|
||||
@ -182,9 +182,8 @@ bool Tesseract::init_tesseract_lang_data(const std::string &arg0,
|
||||
}
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
else if (!mgr->GetComponent(TESSDATA_UNICHARSET, &fp) || !unicharset.load_from_file(&fp, false)) {
|
||||
tprintf(
|
||||
"Error: Tesseract (legacy) engine requested, but components are "
|
||||
"not present in %s!!\n", tessdata_path.string());
|
||||
tesserr << "Error: Tesseract (legacy) engine requested, but components are "
|
||||
"not present in " << tessdata_path.string() << "!!\n";
|
||||
return false;
|
||||
}
|
||||
#endif // ndef DISABLED_LEGACY_ENGINE
|
||||
|
@ -11,6 +11,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include "ccutil.h"
|
||||
#include "tesserrstream.h" // for tesserr
|
||||
#include "tprintf.h" // for tprintf
|
||||
|
||||
#include <cstdlib>
|
||||
@ -51,8 +52,7 @@ std::filesystem::path find_data_path(const std::string &argv0) {
|
||||
if (!argv0.empty()) {
|
||||
std::filesystem::path path(argv0);
|
||||
if (!std::filesystem::is_directory(path)) {
|
||||
tprintf("Warning (tessdata): '%s' is not a valid directory.\n",
|
||||
argv0);
|
||||
tesserr << "Warning (tessdata): '" << argv0 << "' is not a valid directory.\n";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user