gamjaradio / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

tessdll.dll should look for the tessdata dir in the dll directory and not the exe directory #205

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

This is an enhancement request. The current behavior requires the data 
directory in the folder holding the executable program. It makes more 
sense to locate the folder in the directory holding the tessdll.dll file. 
The two folders are not the same. For instance, creating a Python 
extension has the dll in the site-lib folder structure. Also, if multiple 
executables try to share one copy of the dll, they all have to have copies 
of the tessdata directory making installation / maintance harder.

Proposed change:

In file basedir.cpp on the line that gets the module name, make the 
following change.

  if (GetModuleFileName (GetModuleHandle("tessdll"), directory,
                         MAX_PATH - 1) == 0)
  {
    return -1;
  }

If the function GetModuleHandle("tessdll") fails to find the dll (as in 
the case of a compiled exe, then the function returns NULL and the 
behavior remains the same as today using the exe directory. If the 
function finds the dll, it returns the dll handle and that is used to get 
the file name resulting in the path being that of the dll.

The string "tessdll" could be a project define or a passed parameter but 
the odds are very high that everyone will simply use the normal already 
provided Solution files and the name can be a constant string.

This change should be relatively compatible with existing systems. It 
would mostly impact users like myself and I think they would be happy.

What version of the product are you using? On what operating system?

Using version 2.03 compiling on Visual Studio 2008 running XP.

Original issue reported on code.google.com by gldray...@gmail.com on 7 May 2009 at 4:52

GoogleCodeExporter commented 9 years ago
Good idea. Included in 2.04.

Original comment by theraysm...@gmail.com on 29 May 2009 at 8:42