Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
Fix exported application with new Raspbian releases
Browse files Browse the repository at this point in the history
5a63e2a was incomplete since it didn't account for the different directory layout when running as an exported application.
  • Loading branch information
gohai committed Apr 14, 2019
1 parent 7098797 commit eba3392
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gohai/glvideo/GLVideo.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,22 @@ protected static void workaroundBrcm() {

String jar = GLVideo.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String nativeLib = jar.substring(0, jar.lastIndexOf(File.separatorChar));
File symlink = new File(nativeLib + "/linux-armv6hf/libGLESv2.so");

// unfortunately the directory structure differs when running as an exported application
File nativeLibSubdir = new File(nativeLib + "/linux-armv6hf");
if (nativeLibSubdir.exists()) {
// regular
nativeLib += "/linux-armv6hf";
}

File symlink = new File(nativeLib + "/libGLESv2.so");

if (new_lib.isFile() && !symlink.isFile()) {
// attempt to create symlinks that make it compatible
// with earlier Raspbian releases
try {
Files.createSymbolicLink(Paths.get(nativeLib + "/linux-armv6hf/libGLESv2.so"), Paths.get("/opt/vc/lib/libbrcmGLESv2.so"));
Files.createSymbolicLink(Paths.get(nativeLib + "/linux-armv6hf/libEGL.so"), Paths.get("/opt/vc/lib/libbrcmEGL.so"));
Files.createSymbolicLink(Paths.get(nativeLib + "/libGLESv2.so"), Paths.get("/opt/vc/lib/libbrcmGLESv2.so"));
Files.createSymbolicLink(Paths.get(nativeLib + "/libEGL.so"), Paths.get("/opt/vc/lib/libbrcmEGL.so"));
System.out.println("GLVideo: Created compatibility symlinks");
} catch (Exception e) {
System.err.println("GLVideo: Error creating compatibility symlinks");
Expand Down

0 comments on commit eba3392

Please sign in to comment.