diff --git a/installer/deb/filebot.sh b/installer/deb/filebot.sh index fb247606..4984a736 100644 --- a/installer/deb/filebot.sh +++ b/installer/deb/filebot.sh @@ -1,2 +1,2 @@ #!/bin/bash -java -Xmx256m -Dunixfs=false -DuseExtendedFileAttributes=true -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=deb -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -jar /usr/share/filebot/FileBot.jar "$@" +java -Xmx256m -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=deb -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -jar /usr/share/filebot/FileBot.jar "$@" diff --git a/installer/portable/filebot.sh b/installer/portable/filebot.sh index d0290097..3ed885f2 100644 --- a/installer/portable/filebot.sh +++ b/installer/portable/filebot.sh @@ -6,4 +6,4 @@ dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # force JVM language and encoding settings export LANG=en_US.utf8 -java -Xmx256m -Dunixfs=false -DuseExtendedFileAttributes=false -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=portable "-Dapplication.dir=$dir_bin" "-Djava.io.tmpdir=$dir_bin/temp" "-Duser.home=$dir_bin" "-Djna.library.path=$dir_bin" "-Djava.library.path=$dir_bin" -Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=$dir_bin/prefs.properties" -jar "$dir_bin/FileBot.jar" "$@" \ No newline at end of file +java -Xmx256m -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=false -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=portable "-Dapplication.dir=$dir_bin" "-Djava.io.tmpdir=$dir_bin/temp" "-Duser.home=$dir_bin" "-Djna.library.path=$dir_bin" "-Djava.library.path=$dir_bin" -Djava.util.prefs.PreferencesFactory=net.sourceforge.tuned.prefs.FilePreferencesFactory "-Dnet.sourceforge.tuned.prefs.file=$dir_bin/prefs.properties" -jar "$dir_bin/FileBot.jar" "$@" \ No newline at end of file diff --git a/source/net/sourceforge/filebot/Main.java b/source/net/sourceforge/filebot/Main.java index 48433da4..d85988df 100644 --- a/source/net/sourceforge/filebot/Main.java +++ b/source/net/sourceforge/filebot/Main.java @@ -158,9 +158,15 @@ public class Main { throw new RuntimeException(e); // won't happen } - // pre-load media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds) + // pre-load media.types and JNA/GIO (when loaded during DnD it will freeze the UI for a few hundred milliseconds) MediaTypes.getDefault(); - GVFS.isSupported(); + if (useGVFS()) { + try { + GVFS.getDefaultVFS(); + } catch (Throwable e) { + Logger.getLogger(Main.class.getName()).log(Level.SEVERE, e.getMessage(), e); + } + } // pre-load certain resources in the background warmupCachedResources(); diff --git a/source/net/sourceforge/filebot/Settings.java b/source/net/sourceforge/filebot/Settings.java index f3a95aa0..61476def 100644 --- a/source/net/sourceforge/filebot/Settings.java +++ b/source/net/sourceforge/filebot/Settings.java @@ -54,6 +54,11 @@ public final class Settings { } + public static boolean useGVFS() { + return Boolean.parseBoolean(System.getProperty("useGVFS")); + } + + public static boolean useExtendedFileAttributes() { return Boolean.parseBoolean(System.getProperty("useExtendedFileAttributes")); } diff --git a/source/net/sourceforge/filebot/gio/GVFS.java b/source/net/sourceforge/filebot/gio/GVFS.java index 9b08c389..d1c88a31 100644 --- a/source/net/sourceforge/filebot/gio/GVFS.java +++ b/source/net/sourceforge/filebot/gio/GVFS.java @@ -5,7 +5,6 @@ package net.sourceforge.filebot.gio; import java.io.File; import java.net.URI; -import com.sun.jna.Platform; import com.sun.jna.Pointer; @@ -14,7 +13,7 @@ public class GVFS { private static Pointer gvfs; - private synchronized static Pointer getDefaultVFS() { + public synchronized static Pointer getDefaultVFS() { if (gvfs == null) { GIOLibrary.INSTANCE.g_type_init(); gvfs = GIOLibrary.INSTANCE.g_vfs_get_default(); @@ -38,13 +37,4 @@ public class GVFS { } } - - public static boolean isSupported() { - try { - return Platform.isLinux() || Platform.isFreeBSD(); - } catch (Throwable e) { - return false; - } - } - } diff --git a/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java b/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java index e9c5cd5b..25da4eab 100644 --- a/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java +++ b/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java @@ -2,6 +2,8 @@ package net.sourceforge.filebot.ui.transfer; +import static net.sourceforge.filebot.Settings.*; + import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; @@ -99,7 +101,7 @@ public class FileTransferable implements Transferable { @SuppressWarnings("unchecked") public static List getFilesFromTransferable(Transferable tr) throws IOException, UnsupportedFlavorException { - if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && !GVFS.isSupported()) { + if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && !useGVFS()) { // file list flavor return (List) tr.getTransferData(DataFlavor.javaFileListFlavor); } @@ -128,7 +130,7 @@ public class FileTransferable implements Transferable { } catch (IllegalArgumentException exception) { // try handle other GVFS URI schemes try { - if (GVFS.isSupported()) { + if (useGVFS()) { file = GVFS.getPathForURI(uri); } } catch (LinkageError error) {