diff --git a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java index 2b092ec61..644e2418f 100644 --- a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java +++ b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java @@ -273,16 +273,7 @@ protected void finalize() throws Throwable { * @return true on success */ public boolean init(String datapath, String language) { - if (datapath == null) - throw new IllegalArgumentException("Data path must not be null!"); - if (!datapath.endsWith(File.separator)) - datapath += File.separator; - - File tessdata = new File(datapath + "tessdata"); - if (!tessdata.exists() || !tessdata.isDirectory()) - throw new IllegalArgumentException("Data path must contain subfolder tessdata!"); - - return nativeInit(datapath, language); + return init(datapath, language, OEM_DEFAULT); } /** @@ -301,6 +292,10 @@ public boolean init(String datapath, String language, int ocrEngineMode) { if (!datapath.endsWith(File.separator)) datapath += File.separator; + File datapathFile = new File(datapath); + if (!datapathFile.exists()) + throw new IllegalArgumentException("Data path does not exist!"); + File tessdata = new File(datapath + "tessdata"); if (!tessdata.exists() || !tessdata.isDirectory()) throw new IllegalArgumentException("Data path must contain subfolder tessdata!");