* support system property -DuseGVFS=true|false to turn on/off whether GIO is used in DnD
This commit is contained in:
parent
06ad9e710f
commit
f5572c655e
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/bash
|
#!/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 "$@"
|
||||||
|
|
|
@ -6,4 +6,4 @@ dir_bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
# force JVM language and encoding settings
|
# force JVM language and encoding settings
|
||||||
export LANG=en_US.utf8
|
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" "$@"
|
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" "$@"
|
|
@ -158,9 +158,15 @@ public class Main {
|
||||||
throw new RuntimeException(e); // won't happen
|
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();
|
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
|
// pre-load certain resources in the background
|
||||||
warmupCachedResources();
|
warmupCachedResources();
|
||||||
|
|
|
@ -54,6 +54,11 @@ public final class Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean useGVFS() {
|
||||||
|
return Boolean.parseBoolean(System.getProperty("useGVFS"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean useExtendedFileAttributes() {
|
public static boolean useExtendedFileAttributes() {
|
||||||
return Boolean.parseBoolean(System.getProperty("useExtendedFileAttributes"));
|
return Boolean.parseBoolean(System.getProperty("useExtendedFileAttributes"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ package net.sourceforge.filebot.gio;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import com.sun.jna.Platform;
|
|
||||||
import com.sun.jna.Pointer;
|
import com.sun.jna.Pointer;
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ public class GVFS {
|
||||||
private static Pointer gvfs;
|
private static Pointer gvfs;
|
||||||
|
|
||||||
|
|
||||||
private synchronized static Pointer getDefaultVFS() {
|
public synchronized static Pointer getDefaultVFS() {
|
||||||
if (gvfs == null) {
|
if (gvfs == null) {
|
||||||
GIOLibrary.INSTANCE.g_type_init();
|
GIOLibrary.INSTANCE.g_type_init();
|
||||||
gvfs = GIOLibrary.INSTANCE.g_vfs_get_default();
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
package net.sourceforge.filebot.ui.transfer;
|
package net.sourceforge.filebot.ui.transfer;
|
||||||
|
|
||||||
|
|
||||||
|
import static net.sourceforge.filebot.Settings.*;
|
||||||
|
|
||||||
import java.awt.datatransfer.DataFlavor;
|
import java.awt.datatransfer.DataFlavor;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||||
|
@ -99,7 +101,7 @@ public class FileTransferable implements Transferable {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static List<File> getFilesFromTransferable(Transferable tr) throws IOException, UnsupportedFlavorException {
|
public static List<File> getFilesFromTransferable(Transferable tr) throws IOException, UnsupportedFlavorException {
|
||||||
if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && !GVFS.isSupported()) {
|
if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && !useGVFS()) {
|
||||||
// file list flavor
|
// file list flavor
|
||||||
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
||||||
}
|
}
|
||||||
|
@ -128,7 +130,7 @@ public class FileTransferable implements Transferable {
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
// try handle other GVFS URI schemes
|
// try handle other GVFS URI schemes
|
||||||
try {
|
try {
|
||||||
if (GVFS.isSupported()) {
|
if (useGVFS()) {
|
||||||
file = GVFS.getPathForURI(uri);
|
file = GVFS.getPathForURI(uri);
|
||||||
}
|
}
|
||||||
} catch (LinkageError error) {
|
} catch (LinkageError error) {
|
||||||
|
|
Loading…
Reference in New Issue