Cross-Platform: Spike für Betrieb unter PowerShell 7 auf macOS/Linux

Windows-Verhalten bleibt identisch (Pfade/Temp verifiziert). Portable Anpassungen:
- Get-AppDataDir/Test-IsWindows (Models.ps1): App-Daten unter macOS in
  ~/Library/Application Support, Linux in $XDG_CONFIG_HOME/~/.config;
  auf Windows unveraendert %APPDATA%. Settings- und Policy-Export-Pfad nutzen ihn.
- ReportDir ueber [IO.Path]::GetTempPath() statt $env:TEMP (auf macOS/Linux leer).
- Start.ps1: Browser plattformneutral oeffnen (open/xdg-open/Start-Process);
  WMI-Stale-Instanz-Erkennung nur noch auf Windows.
- Datei-/Ordner-Dialog: macOS-nativer osascript-Chooser statt System.Windows.Forms;
  auf nicht unterstuetzten Plattformen klare Fehlermeldung.

Auth (Device-Code-Flow) und HttpListener sind bereits plattformneutral. Test auf
echtem macOS steht aus; Packaging (.app/.dmg) folgt separat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
marcoandClaude Opus 4.8 committed 2026-09-16 15:46:56 +02:00
1 parent 9fb42b4d7e
commit e652891c41
4 files changed
+67 -8

No files matched your search

+26 -2
View File
@@ -26,13 +26,37 @@ function ConvertTo-IsoDate {
return $s
}
# ============================================================
# Plattform-Helfer: App-Daten-Verzeichnis (Settings, Exporte).
# Windows: %APPDATA%\IntuneAppManager-Web (unveraendert).
# macOS: ~/Library/Application Support/IntuneAppManager-Web
# Linux: $XDG_CONFIG_HOME bzw. ~/.config/IntuneAppManager-Web
# ============================================================
function Test-IsWindows {
# PS5.1 kennt $IsWindows nicht -> $env:OS faengt das ab.
return (($env:OS -eq 'Windows_NT') -or ($PSVersionTable.PSVersion.Major -lt 6) -or $IsWindows)
}
function Get-AppDataDir {
$base = if ($env:APPDATA) {
$env:APPDATA
} elseif ($IsMacOS) {
Join-Path $HOME 'Library/Application Support'
} elseif ($IsLinux) {
if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { Join-Path $HOME '.config' }
} else {
[Environment]::GetFolderPath('ApplicationData')
}
return (Join-Path $base 'IntuneAppManager-Web')
}
# ============================================================
# Settings: editierbare Konfiguration, persistiert als JSON
# unter %APPDATA%\IntuneAppManager-Web\settings.json
# unter <AppData>\IntuneAppManager-Web\settings.json
# ============================================================
function Get-SettingsPath {
$dir = Join-Path $env:APPDATA "IntuneAppManager-Web"
$dir = Get-AppDataDir
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
return Join-Path $dir "settings.json"
}