core: prohibit checking for the desktop environment on linux during comptime

This commit is contained in:
Jeffrey C. Ollie
2025-01-01 18:49:26 -06:00
parent 5c39d09053
commit c89df01e13

View File

@ -75,6 +75,7 @@ pub fn desktopEnvironment() DesktopEnvironment {
.macos => .macos, .macos => .macos,
.windows => .windows, .windows => .windows,
.linux => de: { .linux => de: {
if (@inComptime()) @compileError("Checking for the desktop environment on Linux must be done at runtime.");
// use $XDG_SESSION_DESKTOP to determine what DE we are using on Linux // use $XDG_SESSION_DESKTOP to determine what DE we are using on Linux
// https://www.freedesktop.org/software/systemd/man/latest/pam_systemd.html#desktop= // https://www.freedesktop.org/software/systemd/man/latest/pam_systemd.html#desktop=
const de = posix.getenv("XDG_SESSION_DESKTOP") orelse break :de .other; const de = posix.getenv("XDG_SESSION_DESKTOP") orelse break :de .other;