diff options
| author | Wilson E. Alvarez | 2017-08-25 11:14:33 -0400 |
|---|---|---|
| committer | Wilson E. Alvarez | 2017-08-26 16:58:47 -0400 |
| commit | 7a07895920196c00d1ee14187e4ccdb2a6f0d0b9 (patch) | |
| tree | d8acd6c8d53717c3a4ec205b000ac8f0ff1fc985 /platform/x11/power_x11.cpp | |
| parent | 53c0010932f9c1becb63c16243f3a00ede359989 (diff) | |
| download | godot-7a07895920196c00d1ee14187e4ccdb2a6f0d0b9.tar.gz godot-7a07895920196c00d1ee14187e4ccdb2a6f0d0b9.tar.zst godot-7a07895920196c00d1ee14187e4ccdb2a6f0d0b9.zip | |
Diffstat (limited to 'platform/x11/power_x11.cpp')
| -rw-r--r-- | platform/x11/power_x11.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp index 8e69a2223..72fa5cf38 100644 --- a/platform/x11/power_x11.cpp +++ b/platform/x11/power_x11.cpp @@ -58,6 +58,7 @@ Adapted from corresponding SDL 2.0 code. #include <stdio.h> #include <unistd.h> +#include "core/error_macros.h" #include <dirent.h> #include <fcntl.h> #include <sys/stat.h> @@ -254,9 +255,9 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() { this->power_state = POWERSTATE_UNKNOWN; dirp->change_dir(proc_acpi_battery_path); - dirp->list_dir_begin(); + Error err = dirp->list_dir_begin(); - if (dirp == NULL) { + if (err != OK) { return false; /* can't use this interface. */ } else { node = dirp->get_next(); @@ -268,8 +269,8 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() { } dirp->change_dir(proc_acpi_ac_adapter_path); - dirp->list_dir_begin(); - if (dirp == NULL) { + err = dirp->list_dir_begin(); + if (err != OK) { return false; /* can't use this interface. */ } else { node = dirp->get_next(); @@ -438,9 +439,9 @@ bool PowerX11::GetPowerInfo_Linux_sys_class_power_supply(/*PowerState *state, in DirAccess *dirp = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); dirp->change_dir(base); - dirp->list_dir_begin(); + Error err = dirp->list_dir_begin(); - if (!dirp) { + if (err != OK) { return false; } |
