Skip to content

Commit

Permalink
Improve error message when require fails to load a dll.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Feb 9, 2025
1 parent f5631fd commit 2d65274
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/filesystem/wrap_Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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())
Expand All @@ -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)
Expand All @@ -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;
}

Expand Down

0 comments on commit 2d65274

Please sign in to comment.