diff --git a/src/os/flatpak.zig b/src/os/flatpak.zig new file mode 100644 index 000000000..afd6c33de --- /dev/null +++ b/src/os/flatpak.zig @@ -0,0 +1,9 @@ +const std = @import("std"); +const builtin = @import("builtin"); + +/// Returns true if we're running in a Flatpak environment. +pub fn isFlatpak() bool { + // If we're not on Linux then we'll make this comptime false. + if (comptime builtin.os.tag != .linux) return false; + return if (std.fs.accessAbsolute("/.flatpak-info", .{})) true else |_| false; +}