From f346fcdd7cac201b8620cbfc8f329d0199baa44b Mon Sep 17 00:00:00 2001
From: Doronin Stanislav <mugisbrows@gmail.com>
Date: Wed, 21 Dec 2022 00:46:16 +0300
Subject: [PATCH] check msys2 tessdata location

---
 src/ccutil/ccutil.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/ccutil/ccutil.cpp b/src/ccutil/ccutil.cpp
index aad8ef6..18ade02 100644
--- a/src/ccutil/ccutil.cpp
+++ b/src/ccutil/ccutil.cpp
@@ -73,6 +73,15 @@ void CCUtil::main_setup(const std::string &argv0, const std::string &basename) {
           datadir = subdir;
         }
       }
+      separator = std::strrchr(path, '\\'); // cdup from bin directory
+      if (separator != nullptr) {
+        *separator = '\0';
+        std::string subdir = path;
+        subdir += "/share/tessdata";
+        if (std::filesystem::exists(subdir)) {
+          datadir = subdir;
+        }
+      }
     }
 #endif /* _WIN32 */
   }
-- 
2.32.0.windows.2

