Skip to content

Commit c796170

Browse files
committed
Document what happens when datapath is empty
1 parent e8999c7 commit c796170

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tesseract.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func Version() string {
3939
// int TessBaseAPIInit3(TessBaseAPI* handle, const char* datapath, const char* language);
4040

4141
// NewTess creates and returns a new tesseract instance.
42+
// When datapath is an empty string, the TESSDATA_PREFIX environment variable
43+
// is used. If it's empty, the compile-time TESSDATA_PREFIX constant is used
44+
// instead. If it was not defined, datapath is set to the current working
45+
// directory.
4246
func NewTess(datapath string, language string) (*Tess, error) {
4347
// create new empty TessBaseAPI
4448
tba := C.TessBaseAPICreate()
@@ -48,6 +52,7 @@ func NewTess(datapath string, language string) (*Tess, error) {
4852
defer C.free(unsafe.Pointer(cLanguage))
4953

5054
var res C.int
55+
// Tesseract ignores TESSDATA_PREFIX when datapath is not NULL
5156
if datapath != "" {
5257
// prepare string for C call
5358
cDatapath := C.CString(datapath)

0 commit comments

Comments
 (0)