diff --git a/source/net/filebot/gio/GVFS.java b/source/net/filebot/gio/GVFS.java index ca783ecd..b31a9e50 100644 --- a/source/net/filebot/gio/GVFS.java +++ b/source/net/filebot/gio/GVFS.java @@ -10,7 +10,14 @@ public interface GVFS { File getPathForURI(URI uri); public static GVFS getDefaultVFS() { - return SystemProperty.of("net.filebot.gio.GVFS", path -> new PlatformGVFS(new File(path)), NativeGVFS::new).get(); + GVFS gvfs = SystemProperty.of("net.filebot.gio.GVFS", path -> new PlatformGVFS(new File(path))).get(); + + // default to native implementation GVFS folder is not set + if (gvfs == null) { + gvfs = new NativeGVFS(); + } + + return gvfs; } } diff --git a/source/net/filebot/util/SystemProperty.java b/source/net/filebot/util/SystemProperty.java index 1022d5ee..dd0f574d 100644 --- a/source/net/filebot/util/SystemProperty.java +++ b/source/net/filebot/util/SystemProperty.java @@ -4,31 +4,26 @@ import static net.filebot.Logging.*; import java.util.Optional; import java.util.function.Function; -import java.util.function.Supplier; import java.util.logging.Level; public class SystemProperty { - public static SystemProperty of(String key, Function valueFunction, T defaultValue) { - return new SystemProperty(key, valueFunction, () -> defaultValue); - } - public static SystemProperty of(String key, Function valueFunction) { return new SystemProperty(key, valueFunction, null); } - public static SystemProperty of(String key, Function valueFunction, Supplier defaultValue) { + public static SystemProperty of(String key, Function valueFunction, T defaultValue) { return new SystemProperty(key, valueFunction, defaultValue); } private final String key; private final Function valueFunction; - private final Supplier defaultValueFunction; + private final T defaultValue; - private SystemProperty(String key, Function valueFunction, Supplier defaultValue) { + private SystemProperty(String key, Function valueFunction, T defaultValue) { this.key = key; this.valueFunction = valueFunction; - this.defaultValueFunction = defaultValue; + this.defaultValue = defaultValue; } public T get() { @@ -42,7 +37,7 @@ public class SystemProperty { } } - return defaultValueFunction == null ? null : defaultValueFunction.get(); + return defaultValue; } public Optional optional() {