Commit c00545f9 authored by hpi1's avatar hpi1

BDJ: make "user.dir" point to current Xlet home directory

parent 87c267fe
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment