mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-25 08:53:06 +02:00
lib: do flatpak check only once
Either we are in a flatpak or not, this doesn't change, so we can just remember the result.
This commit is contained in:
parent
24f054659c
commit
f6220a2d6e
@ -76,12 +76,17 @@ static char error_string[512] = { 0 };
|
||||
// Helper to check if we are running inside a flatpak
|
||||
static int in_flatpak(void)
|
||||
{
|
||||
static int status = -1;
|
||||
|
||||
if (status == -1) {
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
r = lstat("/.flatpak-info", &sb);
|
||||
status = r == 0 && sb.st_size > 0;
|
||||
}
|
||||
|
||||
return r == 0 && sb.st_size > 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
static int log_error(const char *fmt, ...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user