diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-17 11:23:00 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-17 11:23:00 +0200 |
commit | c72b851dfb46606d3d04d00c79abd555309cae33 (patch) | |
tree | 7b0615635f2d25c86189b5a11c1669acf95db5da /platform/linuxbsd/os_linuxbsd.cpp | |
parent | 9a48b14a2d2422d4f374ce3bf74575da76f3ace4 (diff) | |
parent | 6cc314e0fa3f0070c1bbeef7f8dbabfff976e190 (diff) | |
download | redot-engine-c72b851dfb46606d3d04d00c79abd555309cae33.tar.gz |
Merge pull request #80104 from bruvzg/freedesktop_native_file_dialog
[Linux/Freedesktop] Implement native file selection dialog support.
Diffstat (limited to 'platform/linuxbsd/os_linuxbsd.cpp')
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 14d02a73c8..d22d398a67 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -164,6 +164,27 @@ String OS_LinuxBSD::get_processor_name() const { ERR_FAIL_V_MSG("", String("Couldn't get the CPU model name from `/proc/cpuinfo`. Returning an empty string.")); } +bool OS_LinuxBSD::is_sandboxed() const { + // This function is derived from SDL: + // https://github.com/libsdl-org/SDL/blob/main/src/core/linux/SDL_sandbox.c#L28-L45 + + if (access("/.flatpak-info", F_OK) == 0) { + return true; + } + + // For Snap, we check multiple variables because they might be set for + // unrelated reasons. This is the same thing WebKitGTK does. + if (has_environment("SNAP") && has_environment("SNAP_NAME") && has_environment("SNAP_REVISION")) { + return true; + } + + if (access("/run/host/container-manager", F_OK) == 0) { + return true; + } + + return false; +} + void OS_LinuxBSD::finalize() { if (main_loop) { memdelete(main_loop); |