don't attempt to access linux keychain on non-linux systems, even if classes are present (i.e. when starting from IDE)

[ci skip]
This commit is contained in:
Sebastian Stenzel
2019-07-10 15:15:37 +02:00
parent f16c887911
commit 53cc93a2b4

View File

@@ -1,12 +1,15 @@
package org.cryptomator.keychain;
import org.apache.commons.lang3.SystemUtils;
import java.util.Optional;
public class LinuxKeychainTester {
public static boolean secretServiceIsAvailable() {
try {
Class.forName("org.freedesktop.secret.simple.SimpleCollection");
return true;
return SystemUtils.IS_OS_LINUX; // even if the classes could be loaded, secretService is only available on linux
} catch (ClassNotFoundException e) {
return false;
}