Use -Dnet.filebot.gio.GVFS="$XDG_RUNTIME_DIR/gvfs" for sandboxed snappy app but default to libgio for standard Linux environments

This commit is contained in:
Reinhard Pointner 2016-11-18 18:25:44 +08:00
parent 7bfb19aa35
commit 6f3f27a005
3 changed files with 10 additions and 7 deletions

View File

@ -13,4 +13,4 @@ export APP_DATA="$SNAP_USER_DATA/data"
export APP_CACHE="$SNAP_USER_DATA/cache"
export APP_PREFS="$SNAP_USER_DATA/prefs"
java -Duser.home="$SNAP_USER_DATA" -Djava.library.path="$LD_LIBRARY_PATH" -Djna.library.path="$LD_LIBRARY_PATH" -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Djava.net.useSystemProxies=true -Dapplication.update=skip -Dapplication.deployment=snap -Dnet.filebot.UserFiles.fileChooser=JavaFX -Dapplication.dir="$APP_DATA" -Dapplication.cache="$APP_CACHE/ehcache.disk.store" -Djava.io.tmpdir="$APP_CACHE/java.io.tmpdir" -Djava.util.prefs.userRoot="$APP_PREFS/user" -Djava.util.prefs.systemRoot="$APP_PREFS/system" -Dnet.filebot.AcoustID.fpcalc="$SNAP/usr/bin/fpcalc" $JAVA_OPTS -jar "$APP_ROOT/FileBot.jar" "$@"
java -Duser.home="$SNAP_USER_DATA" -Djava.library.path="$LD_LIBRARY_PATH" -Djna.library.path="$LD_LIBRARY_PATH" -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -DuseCreationDate=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Djava.net.useSystemProxies=true -Dapplication.update=skip -Dapplication.deployment=snap -Dnet.filebot.UserFiles.fileChooser=JavaFX -Dnet.filebot.gio.GVFS="$XDG_RUNTIME_DIR/gvfs" -Dapplication.dir="$APP_DATA" -Dapplication.cache="$APP_CACHE/ehcache.disk.store" -Djava.io.tmpdir="$APP_CACHE/java.io.tmpdir" -Djava.util.prefs.userRoot="$APP_PREFS/user" -Djava.util.prefs.systemRoot="$APP_PREFS/system" -Dnet.filebot.AcoustID.fpcalc="$SNAP/usr/bin/fpcalc" $JAVA_OPTS -jar "$APP_ROOT/FileBot.jar" "$@"

View File

@ -3,12 +3,14 @@ package net.filebot.gio;
import java.io.File;
import java.net.URI;
import net.filebot.util.SystemProperty;
public interface GVFS {
File getPathForURI(URI uri);
public static GVFS getDefaultVFS() {
return new PlatformGVFS();
return SystemProperty.of("net.filebot.gio.GVFS", PlatformGVFS::new, NativeGVFS::new).get();
}
}

View File

@ -4,12 +4,13 @@ package net.filebot.gio;
import java.io.File;
import java.net.URI;
import com.sun.jna.Native;
public class PlatformGVFS implements GVFS {
private static final LibC lib_c = (LibC) Native.loadLibrary("c", LibC.class);
private static final String gvfs = "/run/user/" + lib_c.getuid() + "/gvfs/";
private final File gvfs;
public PlatformGVFS(String gvfs) {
this.gvfs = new File(gvfs);
}
public File getPathForURI(URI uri) {
// e.g. smb://10.0.1.5/data/Movies/Avatar.mp4 -> /run/user/1000/gvfs/smb-share:server=10.0.1.5,share=data/Movies/Avatar.mp4
@ -18,7 +19,7 @@ public class PlatformGVFS implements GVFS {
case "file":
return new File(uri);
default:
return new File(gvfs + uri.getScheme() + "-share:server=" + uri.getHost() + ",share=" + uri.getPath().substring(1));
return new File(gvfs, uri.getScheme() + "-share:server=" + uri.getHost() + ",share=" + uri.getPath().substring(1));
}
}