private static boolean loadEmbeddedLibrary()

in source/neuropod/bindings/java/src/main/java/com/uber/neuropod/LibraryLoader.java [70:98]


    private static boolean loadEmbeddedLibrary() {
        // TODO(weijiad): Should be /com/uber/neuropod/native/{OS}/{PLATFORM} once we figure out how to copy native
        // libraries to that path.
        String resPath = "/";
        if (getOS().equals("unsupported")) {
            throw new NeuropodJNIException("unsupported OS");
        }
        try {
            final File tempPath = Files.createTempDirectory(TEMP_DIRECTORY_NAME).toFile();
            tempPath.deleteOnExit();
            String libAbsPath = tempPath.getCanonicalPath().toString();
            for (String libName : EMBEDDED_LIB_NAMES) {
                File libFile = extractFile(libAbsPath, resPath, libName);
            }
            for (String binName : BIN_NAMES) {
                File binFile = extractFile(libAbsPath, resPath, binName);
                if (binFile != null) {
                    binFile.setExecutable(true);
                }
            }
            File libFile = extractFile(libAbsPath, resPath, System.mapLibraryName(JNI_NAME));
            System.load(libFile.getCanonicalPath());
            nativeExport(libAbsPath);
        } catch (IOException e) {
            System.out.println(e.getMessage());
            return false;
        }
        return true;
    }