From 2598a51316a480c477f7a55cb9c3b94c34416585 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 26 Nov 2022 20:54:46 -0400 Subject: [PATCH 1/2] Unify love.system.getOS and love._os implementations. --- src/modules/love/love.cpp | 19 +++++++------------ src/modules/system/System.cpp | 2 +- src/modules/system/System.h | 2 +- src/modules/system/wrap_System.cpp | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index ab511a05e..4c1494aa4 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -86,6 +86,11 @@ extern "C" # include "audio/Audio.h" #endif +// For love::system::System::getOS. +#ifdef LOVE_ENABLE_SYSTEM +# include "system/System.h" +#endif + // Scripts. #include "scripts/nogame.lua.h" @@ -599,18 +604,8 @@ int luaopen_love(lua_State *L) lua_pushcfunction(L, w_love_isVersionCompatible); lua_setfield(L, -2, "isVersionCompatible"); -#ifdef LOVE_WINDOWS_UWP - lua_pushstring(L, "UWP"); -#elif LOVE_WINDOWS - lua_pushstring(L, "Windows"); -#elif defined(LOVE_MACOS) - lua_pushstring(L, "OS X"); -#elif defined(LOVE_IOS) - lua_pushstring(L, "iOS"); -#elif defined(LOVE_ANDROID) - lua_pushstring(L, "Android"); -#elif defined(LOVE_LINUX) - lua_pushstring(L, "Linux"); +#ifdef LOVE_ENABLE_SYSTEM + lua_pushstring(L, love::system::System::getOS()); #else lua_pushstring(L, "Unknown"); #endif diff --git a/src/modules/system/System.cpp b/src/modules/system/System.cpp index 800bf5866..fc3fa935b 100644 --- a/src/modules/system/System.cpp +++ b/src/modules/system/System.cpp @@ -62,7 +62,7 @@ System::System() { } -std::string System::getOS() const +const char *System::getOS() { #if defined(LOVE_MACOS) return "OS X"; diff --git a/src/modules/system/System.h b/src/modules/system/System.h index 8a40f59e9..f81862fe8 100644 --- a/src/modules/system/System.h +++ b/src/modules/system/System.h @@ -57,7 +57,7 @@ public: /** * Gets the current operating system. **/ - std::string getOS() const; + static const char *getOS(); /** * Gets the number of reported CPU cores on the current system. diff --git a/src/modules/system/wrap_System.cpp b/src/modules/system/wrap_System.cpp index d7d3209bd..0c0d7c6ad 100644 --- a/src/modules/system/wrap_System.cpp +++ b/src/modules/system/wrap_System.cpp @@ -31,7 +31,7 @@ namespace system int w_getOS(lua_State *L) { - luax_pushstring(L, instance()->getOS()); + luax_pushstring(L, System::getOS()); return 1; } From 77e602f055ad750f7b1f25553889b631a166491e Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Sun, 27 Nov 2022 12:46:20 +0800 Subject: [PATCH 2/2] Workaround GitHub Actions build issue in Windows. See actions/runner-images#6627 --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71eb59be0..b818cf5f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,6 +113,13 @@ jobs: if: steps.vars.outputs.angle == '1' working-directory: angle run: 7z x angle-win-${{ steps.vars.outputs.arch }}.zip + - name: Delete Strawbery Perl + # https://github.com/actions/runner-images/issues/6627 + # In particular, this is not pretty, but even CMAKE_IGNORE_PREFIX_PATH + # cannot help in this case. Delete the whole folder! + run: | + rmdir /s /q C:\Strawberry + exit /b 0 - name: Configure run: cmake -Bbuild -Hmegasource -T v142 -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=%CD%\install ${{ steps.vars.outputs.moredef }} - name: Install