diff options
author | Nick White <git@njw.name> | 2024-02-06 08:17:24 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2024-02-06 15:11:22 +0000 |
commit | d2399a7ce0af49098a065c48409d1512f37c7c21 (patch) | |
tree | be8d15fd3631ca3a0fe6e1f76e8146abadc933ac /cmd/rescribe/gui.go | |
parent | f9199fe32b894757bce1065ac99dec6a8ce65f89 (diff) |
Fix selecting a custom training file in flatpak
This is done by copying any training to the temporary tesseract
directory, and always using that as the TESSDIR. This works as
it's writeable (unlike the /app/share directory that flatpak
would otherwise work)
Diffstat (limited to 'cmd/rescribe/gui.go')
-rw-r--r-- | cmd/rescribe/gui.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/rescribe/gui.go b/cmd/rescribe/gui.go index 8790f03..73f1db2 100644 --- a/cmd/rescribe/gui.go +++ b/cmd/rescribe/gui.go @@ -134,14 +134,18 @@ func trainingSelectOnChange(sel *widget.Select, parent fyne.Window) func(string) newpath := filepath.Join(os.Getenv("TESSDATA_PREFIX"), name) f, err := os.Create(newpath) if err != nil { - // TODO: surface error somewhere, prob with a dialog box + msg := fmt.Sprintf("Error creating temporary file to store custom training: %v\n", err) + dialog.ShowError(errors.New(msg), parent) + fmt.Fprintf(os.Stderr, msg) sel.SetSelectedIndex(0) return } defer f.Close() _, err = io.Copy(f, uri) if err != nil { - // TODO: surface error somewhere, prob with a dialog box + msg := fmt.Sprintf("Error copying custom training to temporary file: %v\n", err) + dialog.ShowError(errors.New(msg), parent) + fmt.Fprintf(os.Stderr, msg) sel.SetSelectedIndex(0) return } |