Prevent platform profile error on unsupported systems

If a system does not support setting the platform profile (i.e., does
not have the file /sys/firmware/acpi/platform_profile), then everything
that interacts with it is skipped to prevent errors. This situation is
more common than I expected.[1]

[1] https://github.com/FeralInteractive/gamemode/issues/524
This commit is contained in:
MithicSpirit
2025-03-12 13:11:39 -04:00
committed by afayaz-feral
parent 5f691c3171
commit 499af4c7bb
4 changed files with 28 additions and 4 deletions

View File

@ -39,6 +39,14 @@ POSSIBILITY OF SUCH DAMAGE.
*/
const char *profile_path = "/sys/firmware/acpi/platform_profile";
/**
* Check if platform profile file exists
*/
int profile_exists(void)
{
return !access(profile_path, F_OK);
}
/**
* Return the current platform profile state
*/