[libbluray-devel] BDJ: make "user.dir" point to current Xlet home directory
hpi1
git at videolan.org
Mon Mar 9 12:53:05 CET 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Mar 9 13:46:44 2015 +0200| [c00545f9608bf8ffad54b213b5201083d7b81aac] | committer: hpi1
BDJ: make "user.dir" point to current Xlet home directory
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c00545f9608bf8ffad54b213b5201083d7b81aac
---
src/libbluray/bdj/java/org/videolan/Libbluray.java | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 7222b05..3add87b 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -48,6 +48,30 @@ import org.videolan.media.content.PlayerManager;
*/
public class Libbluray {
+ /* hook system properties: make "user.dir" point to current Xlet home directory */
+
+ private static boolean propertiesHooked = false;
+
+ private static void hookProperties() {
+ if (propertiesHooked) {
+ return;
+ }
+ propertiesHooked = true;
+
+ java.util.Properties p = new java.util.Properties(System.getProperties()) {
+ public String getProperty(String key) {
+ if (key.equals("user.dir")) {
+ BDJXletContext ctx = BDJXletContext.getCurrentContext();
+ if (ctx != null) {
+ return ctx.getXletHome();
+ }
+ }
+ return super.getProperty(key);
+ }
+ };
+ System.setProperties(p);
+ }
+
private static String canonicalize(String path, boolean create) {
try {
File dir = new File(path);
@@ -65,6 +89,8 @@ public class Libbluray {
private static void init(long nativePointer, String discID, String discRoot,
String persistentRoot, String budaRoot) {
+ hookProperties();
+
/* set up directories */
persistentRoot = canonicalize(persistentRoot, true);
budaRoot = canonicalize(budaRoot, true);
More information about the libbluray-devel
mailing list