Skip to content

Commit

Permalink
Fix setup of datadir on installations with Conda (issue #4230)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed May 15, 2024
1 parent f3974d4 commit bcfdd5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ccutil/ccutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ void CCUtil::main_setup(const std::string &argv0, const std::string &basename) {
if (datadir.empty()) {
#if defined(TESSDATA_PREFIX)
// Use tessdata prefix which was compiled in.
datadir = TESSDATA_PREFIX "/tessdata/";
// Note that some software (for example conda) patches TESSDATA_PREFIX
// in the binary, so it should not be used directly with a std::string.
tessdata_prefix = TESSDATA_PREFIX;
datadir = tessdata_prefix;
datadir += "/tessdata/";
// in the binary, so it might be shorter. Recalculate its length.
datadir.resize(std::strlen(datadir.c_str()));
#else
datadir = "./";
#endif /* TESSDATA_PREFIX */
Expand Down

0 comments on commit bcfdd5e

Please sign in to comment.