@@ -18,6 +18,8 @@ public static class GlobalParams {
1818 public String fontconfigDataPath ;
1919 public String popplerDataPath ;
2020 public String pdf2htmlexDataPath ;
21+ public String libmagicDatabasePath ;
22+
2123 public String customTmpfilePath ;
2224 }
2325
@@ -29,23 +31,32 @@ public static void initialize(Context context) {
2931 File fontconfigDataDirectory = new File (assetsDirectory , "fontconfig" );
3032 File popplerDataDirectory = new File (assetsDirectory , "poppler" );
3133 File pdf2htmlexDataDirectory = new File (assetsDirectory , "pdf2htmlex" );
34+ File libmagicDataDirectory = new File (assetsDirectory , "libmagic" );
3235
3336 AssetExtractor ae = new AssetExtractor (context .getAssets ());
3437 ae .setOverwrite ();
3538 ae .extract (assetsDirectory , "core/odrcore" );
3639 ae .extract (assetsDirectory , "core/fontconfig" );
3740 ae .extract (assetsDirectory , "core/poppler" );
3841 ae .extract (assetsDirectory , "core/pdf2htmlex" );
42+ ae .extract (assetsDirectory , "core/libmagic" );
3943
4044 CoreWrapper .GlobalParams globalParams = new CoreWrapper .GlobalParams ();
4145 globalParams .coreDataPath = odrCoreDataDirectory .getAbsolutePath ();
4246 globalParams .fontconfigDataPath = fontconfigDataDirectory .getAbsolutePath ();
4347 globalParams .popplerDataPath = popplerDataDirectory .getAbsolutePath ();
4448 globalParams .pdf2htmlexDataPath = pdf2htmlexDataDirectory .getAbsolutePath ();
49+ globalParams .libmagicDatabasePath = new File (libmagicDataDirectory , "magic.mgc" ).getAbsolutePath ();
4550 globalParams .customTmpfilePath = context .getCacheDir ().getAbsolutePath ();
4651 CoreWrapper .setGlobalParams (globalParams );
4752 }
4853
54+ public static String mimetype (String path ) {
55+ return mimetypeNative (path );
56+ }
57+
58+ private static native String mimetypeNative (String path );
59+
4960 public static class CoreOptions {
5061 public boolean ooxml ;
5162 public boolean txt ;
0 commit comments