summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java
diff options
context:
space:
mode:
authorSimon Rettberg2026-06-01 14:33:45 +0200
committerSimon Rettberg2026-06-01 14:33:45 +0200
commit75420b7417c269035382532da47fb4cee7c4d82d (patch)
tree9064ac2b38042dd78b716f82a30a8b054318e33f /dozentenmodul/src/main/java
parent[server] Don't delete dmsd session on cow, needed for suite handover (diff)
downloadtutor-module-75420b7417c269035382532da47fb4cee7c4d82d.tar.gz
tutor-module-75420b7417c269035382532da47fb4cee7c4d82d.tar.xz
tutor-module-75420b7417c269035382532da47fb4cee7c4d82d.zip
[client] Improve MacOS support
Diffstat (limited to 'dozentenmodul/src/main/java')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/App.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/Branding.java2
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/Config.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/DesktopEnvironment.java2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/OsHelper.java3
6 files changed, 28 insertions, 9 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
index 7d31b54f..9d385555 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
@@ -38,6 +38,7 @@ import org.openslx.dozmod.gui.helper.Language;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.util.ClientVersion;
import org.openslx.dozmod.util.CombinedTrustManager;
+import org.openslx.dozmod.util.OsHelper;
import org.openslx.dozmod.util.ProxyConfigurator;
import org.openslx.thrifthelper.ThriftManager;
import org.openslx.util.AppUtil;
@@ -180,9 +181,12 @@ public class App {
UIManager.setLookAndFeel(System.getProperty("swing.defaultlaf"));
} else if(Config.getLookAndFeel() != null) {
UIManager.setLookAndFeel(Config.getLookAndFeel());
- } else {
+ } else if (OsHelper.isLinux()) {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
Config.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+ } else {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ Config.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
} catch (Throwable e1) {
try {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/Branding.java b/dozentenmodul/src/main/java/org/openslx/dozmod/Branding.java
index 6b82cf66..22c33bbe 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/Branding.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/Branding.java
@@ -100,6 +100,8 @@ public final class Branding {
if (Util.isEmptyString(path)) {
path = "C:\\ProgramData";
}
+ } else if (OsHelper.isMac()) {
+ path = "/Library/Application Support";
} else {
path = "/etc";
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
index c9f94300..4fa43a51 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
@@ -73,20 +73,28 @@ public class Config {
// should point to a path similar to:
// C:\Users\<user>\AppData\Roaming
String appDataPath = System.getenv("APPDATA");
- if (!appDataPath.isEmpty()) {
+ if (appDataPath != null && !appDataPath.isEmpty()) {
configPath = appDataPath;
} else {
// APPDATA was empty, let's guess
LOGGER.warn("APPDATA is empty.");
configPath = System.getProperty("user.home") + "\\AppData\\Roaming";
}
+ } else if (OsHelper.isMac()) {
+ // macOS: use standard Application Support directory
+ configPath = System.getProperty("user.home") + "/Library/Application Support";
} else if (OsHelper.isLinux()) {
- configPath = System.getProperty("user.home") + "/.config";
+ // Linux: respect XDG_CONFIG_HOME if set, otherwise default to ~/.config
+ String xdgConfigHome = System.getenv("XDG_CONFIG_HOME");
+ if (xdgConfigHome != null && !xdgConfigHome.isEmpty()) {
+ configPath = xdgConfigHome;
+ } else {
+ configPath = System.getProperty("user.home") + "/.config";
+ }
}
if (configPath == null || configPath.isEmpty()) {
- // Not Windows nor Linux, try fallback to relative path
- // TODO MacOS Support?
- configPath = ".";
+ LOGGER.warn("Could not determine config directory for OS: " + OsHelper.osName);
+ configPath = System.getProperty("user.home");
}
// Check if we got a path
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java
index ed3df849..5aedf14a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java
@@ -18,6 +18,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.util.OsHelper;
import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QFileChooser;
@@ -55,17 +56,16 @@ public class ImageOvfConversionPage extends ImageOvfConversionPageLayout {
this.canComeBack = false;
this.state = uploadWizardState;
page = this;
- String os = System.getProperty("os.name");
// Linux install should have put the ovftool into the path variable.
// Try to set it for windows and macos.
- if (os.toLowerCase().contains("windows")) {
+ if (OsHelper.isWindows()) {
ovfToolPath = System.getenv("ProgramFiles(X86)")
+ "\\VMware\\VMware Workstation\\OVFTool\\ovftool.exe";
if (!(new File(ovfToolPath).exists())) {
ovfToolPath = System.getenv("ProgramFiles(X86)")
+ "\\VMware\\VMware Player\\OVFTool\\ovftool.exe";
}
- } else if (os.toLowerCase().contains("mac")) {
+ } else if (OsHelper.isMac()) {
ovfToolPath = "/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool";
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/DesktopEnvironment.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/DesktopEnvironment.java
index 3f8caa74..098ec01f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/DesktopEnvironment.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/DesktopEnvironment.java
@@ -106,6 +106,8 @@ public class DesktopEnvironment {
String[] execCommand;
if (OsHelper.isLinux()) {
execCommand = new String[] { "xdg-open", link };
+ } else if (OsHelper.isMac()) {
+ execCommand = new String[] { "open", link };
} else if (OsHelper.isWindows()) {
execCommand = new String[] { "cmd.exe", "/c", "start", link };
} else {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/OsHelper.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/OsHelper.java
index e844d0c6..26c2816c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/OsHelper.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/OsHelper.java
@@ -10,4 +10,7 @@ public final class OsHelper {
public final static boolean isLinux() {
return osName.contains("linux");
}
+ public final static boolean isMac() {
+ return osName.contains("mac");
+ }
}