From 2d65274ae667703d48eeab5f37807503cf71f2b7 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 9 Feb 2025 14:11:57 -0400 Subject: [PATCH] Improve error message when require fails to load a dll. --- src/modules/filesystem/wrap_Filesystem.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index ba6d82fe6..0d01fe8b5 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -960,6 +960,8 @@ int extloader(lua_State *L) SDL_SharedObject *handle = nullptr; auto *inst = instance(); + std::string loaderror = ""; + #ifdef LOVE_ANDROID // Specifically Android, look the library path based on getCRequirePath first std::string androidPath(love::android::getCRequirePath()); @@ -975,6 +977,7 @@ int extloader(lua_State *L) if (!handle) { + loaderror += std::string(" ") + std::string(SDL_GetError()); #endif // LOVE_ANDROID for (const std::string &el : inst->getCRequirePath()) @@ -1000,6 +1003,8 @@ int extloader(lua_State *L) // Can fail, for instance if it turned out the source was a zip if (handle) break; + else + loaderror += std::string(" ") + std::string(SDL_GetError()); } if (handle) @@ -1012,7 +1017,7 @@ int extloader(lua_State *L) if (!handle) { - lua_pushfstring(L, "\n\tno file '%s' in LOVE paths.", tokenized_name.c_str()); + lua_pushfstring(L, "\n\tno valid C library '%s' in LOVE paths.%s", tokenized_name.c_str(), loaderror.c_str()); return 1; }