diff --git a/es-core/src/platform.cpp b/es-core/src/platform.cpp index e1663a5f97..9c438e2b29 100644 --- a/es-core/src/platform.cpp +++ b/es-core/src/platform.cpp @@ -3,8 +3,11 @@ #include #include -#ifdef WIN32 -#include +#if defined(WIN32) + #include +#elif define(__linux__) + #include + #include #endif std::string getHomePath() @@ -41,18 +44,24 @@ std::string getHomePath() int runShutdownCommand() { -#ifdef WIN32 // windows +#if defined(WIN32) return system("shutdown -s -t 0"); -#else // osx / linux +#elif defined(__linux__) + sync(); + return reboot(RB_POWER_OFF); +#else return system("sudo shutdown -h now"); #endif } int runRestartCommand() { -#ifdef WIN32 // windows +#if defined(WIN32) return system("shutdown -r -t 0"); -#else // osx / linux +#elif defined(__linux__) + sync(); + return reboot(RB_AUTOBOOT); +#else return system("sudo shutdown -r now"); #endif } @@ -69,4 +78,4 @@ int runSystemCommand(const std::string& cmd_utf8) #else return system(cmd_utf8.c_str()); #endif -} \ No newline at end of file +}