Fixed issues with isGnome() detection on Unix (FreeBSD)
This commit is contained in:
parent
d390b294b1
commit
ee54ab39bc
|
@ -261,12 +261,13 @@ class OSUtil {
|
|||
boolean isUbuntu() {
|
||||
return getInfo("ubuntu");
|
||||
}
|
||||
}
|
||||
|
||||
public static
|
||||
class DesktopEnv {
|
||||
public static
|
||||
boolean isGnome() {
|
||||
if (!OS.isLinux()) {
|
||||
if (!OS.isLinux() && !OS.isUnix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -274,10 +275,15 @@ class OSUtil {
|
|||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(8196);
|
||||
PrintStream outputStream = new PrintStream(byteArrayOutputStream);
|
||||
|
||||
// ps a | grep [g]nome-shell
|
||||
// ps a | grep gnome-shell
|
||||
// ps x | grep gnome-shell
|
||||
final ShellProcessBuilder shell = new ShellProcessBuilder(outputStream);
|
||||
shell.setExecutable("ps");
|
||||
if (OS.isLinux()) {
|
||||
shell.addArgument("a");
|
||||
} else {
|
||||
shell.addArgument("x");
|
||||
}
|
||||
shell.start();
|
||||
|
||||
String output = ShellProcessBuilder.getOutput(byteArrayOutputStream);
|
||||
|
@ -290,7 +296,7 @@ class OSUtil {
|
|||
|
||||
public static
|
||||
String getGnomeVersion() {
|
||||
if (!OS.isLinux()) {
|
||||
if (!OS.isLinux() && !OS.isUnix()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -340,7 +346,7 @@ class OSUtil {
|
|||
// cannot represent '5.6.5' as a number, so we return a String instead
|
||||
public static
|
||||
String getPlasmaVersionFull() {
|
||||
if (!OS.isLinux()) {
|
||||
if (!OS.isLinux() && !OS.isUnix()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -372,5 +378,4 @@ class OSUtil {
|
|||
return "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user