@@ -9,33 +9,44 @@ public class KindOfKeePassXC {
9
9
private static final Logger LOG = LoggerFactory .getLogger (KindOfKeePassXC .class );
10
10
11
11
public static Optional <KeePassXCType > determineType () {
12
+ ///home/<user>/Downloads/KeePassXC-2.7.4-x86_64.AppImage
12
13
var processHandle = ProcessHandle .allProcesses ()
13
- .filter (ph -> ph .info ().command ().isPresent () && ph .info ().command ().get ().contains ("KeePassXC" ))
14
+ .filter (ph -> ph .info ().command ().isPresent () && ph .info ().command ().get ().contains ("KeePassXC" )
15
+ && ph .info ().command ().get ().contains ("AppImage" ))
14
16
.findFirst ();
15
17
16
- ///home/<user>/Downloads/KeePassXC-2.7.4-x86_64.AppImage
17
- if (processHandle .isPresent () && processHandle .get ().info ().command ().get ().contains ("AppImage" )) {
18
+ if (processHandle .isPresent ()) {
18
19
LOG .debug ("Found running KeePassXC AppImage" );
19
20
return Optional .of (KeePassXCType .AppImage );
20
21
}
21
22
23
+ ///usr/bin/bwrap --args 38 keepassxc-wrapper
22
24
processHandle = ProcessHandle .allProcesses ()
23
- .filter (ph -> ph .info ().commandLine ().isPresent () && ph .info ().commandLine ().get ().contains ("keepassxc" ))
25
+ .filter (ph -> ph .info ().commandLine ().isPresent () && ph .info ().commandLine ().get ().contains ("keepassxc" )
26
+ && ph .info ().commandLine ().get ().contains ("bwrap" ))
24
27
.findFirst ();
25
28
26
- ///usr/bin/bwrap --args 38 keepassxc-wrapper
27
- if (processHandle .isPresent () && processHandle .get ().info ().commandLine ().get ().contains ("bwrap" )) {
29
+ if (processHandle .isPresent ()) {
28
30
LOG .debug ("Found running KeePassXC installed via Flatpak" );
29
31
return Optional .of (KeePassXCType .Flatpak );
30
32
}
31
33
32
34
///snap/keepassxc/1645/usr/bin/keepassxc
33
- if (processHandle .isPresent () && processHandle .get ().info ().commandLine ().get ().contains ("snap" )) {
35
+ processHandle = ProcessHandle .allProcesses ()
36
+ .filter (ph -> ph .info ().commandLine ().isPresent () && ph .info ().commandLine ().get ().contains ("keepassxc" )
37
+ && ph .info ().commandLine ().get ().contains ("snap" ))
38
+ .findFirst ();
39
+
40
+ if (processHandle .isPresent ()) {
34
41
LOG .debug ("Found running KeePassXC installed via Snap" );
35
42
return Optional .of (KeePassXCType .Snap );
36
43
}
37
44
38
45
///usr/bin/keepassxc, gets started as "keepassxc"
46
+ processHandle = ProcessHandle .allProcesses ()
47
+ .filter (ph -> ph .info ().commandLine ().isPresent () && ph .info ().commandLine ().get ().contains ("keepassxc" ))
48
+ .findFirst ();
49
+
39
50
if (processHandle .isPresent ()) {
40
51
LOG .debug ("Found running KeePassXC installed from repository" );
41
52
return Optional .of (KeePassXCType .Repo );
0 commit comments