Don't print error: XDG_RUNTIME_DIR not set in the environment. when $XDG_RUNTIME_DIR is not set

According to [the manpage](https://manpages.debian.org/experimental/libwayland-doc/wl_display_connect.3.en.html), $XDG_RUNTIME_DIR must be set before calling `wl_display_connect(NULL)`.
Otherwise `wl_display_connect` will always fail, and print the error message
This commit is contained in:
李通洲
2021-10-17 18:18:15 +08:00
parent 8d7d33882f
commit 3a649493ea
+3
View File
@@ -442,6 +442,9 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u
static bool printResolutionWaylandBackend(FFinstance* instance)
{
if(getenv("XDG_RUNTIME_DIR") == NULL)
return false;
const char* sessionType = getenv("XDG_SESSION_TYPE");
if(sessionType != NULL && strcasecmp(sessionType, "wayland") != 0)
return false;