[libbluray-devel] [Git][videolan/libbluray][master] BD-J: search for .jar file from relative install path

Petri Hintukainen (@hpi) gitlab at videolan.org
Wed Sep 21 16:15:10 UTC 2022



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
066d3342 by François Cartegnie at 2022-09-21T16:15:07+00:00
BD-J: search for .jar file from relative install path

no need for CLASSPATH environment var with custom prefix installs

- - - - -


1 changed file:

- src/libbluray/bdj/bdj.c


Changes:

=====================================
src/libbluray/bdj/bdj.c
=====================================
@@ -583,18 +583,22 @@ static char *_find_libbluray_jar0()
     // check directory where libbluray.so was loaded from
     const char *lib_path = dl_get_path();
     if (lib_path) {
-        char *cp = str_printf("%s" BDJ_JARFILE, lib_path);
-        if (!cp) {
-            BD_DEBUG(DBG_CRIT, "out of memory\n");
-            return NULL;
-        }
+        for(i =0; i<2; i++) {
+            const char * relinstalldir[2] = { "",
+                                              ".." DIR_SEP "share" DIR_SEP "java" DIR_SEP };
+            char *cp = str_printf("%s%s%s", lib_path, relinstalldir[i], BDJ_JARFILE);
+            if (!cp) {
+                BD_DEBUG(DBG_CRIT, "out of memory\n");
+                return NULL;
+            }
 
-        BD_DEBUG(DBG_BDJ, "Checking %s ...\n", cp);
-        if (_can_read_file(cp)) {
-            BD_DEBUG(DBG_BDJ, "using %s\n", cp);
-            return cp;
+            BD_DEBUG(DBG_BDJ, "Checking %s ...\n", cp);
+            if (_can_read_file(cp)) {
+                BD_DEBUG(DBG_BDJ, "using %s\n", cp);
+                return cp;
+            }
+            X_FREE(cp);
         }
-        X_FREE(cp);
     }
 
     // check pre-defined directories



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/066d33425e71c5f3f87553dc1736a7aa79f7cf25

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/066d33425e71c5f3f87553dc1736a7aa79f7cf25
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libbluray-devel mailing list