From a798db15135d56205bbe3660741b53837094914b Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 29 Jun 2021 12:38:44 +0100 Subject: rescribe: Add embed target for darwin (osx) too --- cmd/rescribe/embed_darwin.go | 2 +- cmd/rescribe/getembeds.go | 1 + cmd/rescribe/main.go | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/rescribe/embed_darwin.go b/cmd/rescribe/embed_darwin.go index cad8a29..719c9cc 100644 --- a/cmd/rescribe/embed_darwin.go +++ b/cmd/rescribe/embed_darwin.go @@ -6,5 +6,5 @@ package main import _ "embed" -// TODO: add go:embed here +//go:embed tesseract-osx-v4.1.1.20191227.zip var tesszip []byte diff --git a/cmd/rescribe/getembeds.go b/cmd/rescribe/getembeds.go index e59e888..a3edaf2 100644 --- a/cmd/rescribe/getembeds.go +++ b/cmd/rescribe/getembeds.go @@ -43,6 +43,7 @@ func main() { urls := []string { "https://rescribe.xyz/rescribe/embeds/tessdata.20210622.zip", "https://rescribe.xyz/rescribe/embeds/tesseract-linux-v5.0.0-alpha.20210510.zip", + "https://rescribe.xyz/rescribe/embeds/tesseract-osx-v4.1.1.20191227.zip", "https://rescribe.xyz/rescribe/embeds/tesseract-w32-v5.0.0-alpha.20210506.zip", } for _, v := range urls { diff --git a/cmd/rescribe/main.go b/cmd/rescribe/main.go index eb9719f..814504b 100644 --- a/cmd/rescribe/main.go +++ b/cmd/rescribe/main.go @@ -191,11 +191,12 @@ These training files are included in rescribe, and are always available: log.Fatalln("Error unpacking embedded Tesseract zip:", err) } switch runtime.GOOS { - case "windows": - tessCommand = filepath.Join(tessdir, "tesseract.exe") + case "darwin": + tessCommand = filepath.Join(tessdir, "tesseract") case "linux": tessCommand = filepath.Join(tessdir, "tesseract") - // TODO: add osx + case "windows": + tessCommand = filepath.Join(tessdir, "tesseract.exe") } } @@ -241,6 +242,7 @@ These training files are included in rescribe, and are always available: fmt.Fprintf(os.Stderr, "Ensure that Tesseract is installed and available, or don't use the -systess flag.\n") fmt.Fprintf(os.Stderr, "You may need to -tesscmd to the full path of Tesseract.exe if you're on Windows, like this:\n") fmt.Fprintf(os.Stderr, " rescribe -tesscmd 'C:\\Program Files\\Tesseract OCR (x86)\\tesseract.exe' ...\n") + fmt.Fprintf(os.Stderr, "Error message: %v\n", err) os.Exit(1) } -- cgit v1.2.1-24-ge1ad