nguyenq / tess4j

Java JNA wrapper for Tesseract OCR API
Apache License 2.0
1.6k stars 373 forks source link

DLL Extracting on linux even when using custom libs path and not utilizing LoadLibs.extractTessResources() #229

Closed dreamwraith closed 2 years ago

dreamwraith commented 2 years ago

Is there any way to prevent the described behavior?

I have coded in my application to not utilize LoadLibs.extractTessResources() when I am running on a particular platform (linux based), and instead I pass the library location.

However, no matter what I do, as soon as I instantiate an instance of Tesseract1() the dll files are extracted. This results in it repeating the extraction every time the class is instantiated as well, significantly slowing down performance when it is not needed.

Can the class instantiation be made to not extract the DLL files unless LoadLibs.extractTessResources() is called?

nguyenq commented 2 years ago

You're right. Windows DLLs should not be extracted when the program is run on Linux or non-Windows platforms. The resource loading is defined in LoadLibs class. Can you submit a PR?

dreamwraith commented 2 years ago

You're right. Windows DLLs should not be extracted when the program is run on Linux or non-Windows platforms. The resource loading is defined in LoadLibs class. Can you submit a PR?

I will take a look when I am back at work this week and see what I can muster up. Thanks.

nguyenq commented 2 years ago

@dreamwraith I checked in a fix for this issue. Please verify. Thanks.

dreamwraith commented 2 years ago

@nguyenq Apologies, checking in on this - I have not yet been able to get back to testing this due to competing priorities. Should be able to validate sometime next month.

dreamwraith commented 2 years ago

@nguyenq this change seemed to have worked for me. Thanks!