File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/org/cryptomator/linux/sidebar Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
package org .cryptomator .linux .sidebar ;
2
2
3
+ import org .cryptomator .integrations .common .CheckAvailability ;
3
4
import org .cryptomator .integrations .sidebar .SidebarService ;
4
5
import org .cryptomator .integrations .sidebar .SidebarServiceException ;
5
6
9
10
import java .nio .file .Path ;
10
11
import java .nio .file .StandardCopyOption ;
11
12
import java .nio .file .StandardOpenOption ;
13
+ import java .util .concurrent .TimeUnit ;
12
14
import java .util .concurrent .locks .Lock ;
13
15
import java .util .concurrent .locks .ReentrantReadWriteLock ;
14
16
17
+ @ CheckAvailability
15
18
public class NautilusSidebarService implements SidebarService {
16
19
17
20
private static final int MAX_FILE_SIZE = 4096 ;
@@ -72,4 +75,17 @@ public void remove() throws SidebarServiceException {
72
75
}
73
76
}
74
77
}
78
+
79
+ @ CheckAvailability
80
+ public static boolean isSupported () {
81
+ try {
82
+ var nautilusExistsProc = new ProcessBuilder ().command ("test" , "`command -v nautilus`" ).start ();
83
+ if (nautilusExistsProc .waitFor (5000 , TimeUnit .MILLISECONDS )) {
84
+ return nautilusExistsProc .exitValue () == 0 ;
85
+ }
86
+ } catch (IOException | InterruptedException e ) {
87
+ //NO-OP
88
+ }
89
+ return false ;
90
+ }
75
91
}
You can’t perform that action at this time.
0 commit comments