From 755e8c3e1011938dd7d24727d1be15aae4d6bcb7 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sat, 9 Mar 2024 18:27:30 -0500 Subject: [PATCH] Fix regression in lua_load path handling This should resolve #1778 (and similar issues). --- src/llua.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/llua.cc b/src/llua.cc index 1353ce38..1306e378 100644 --- a/src/llua.cc +++ b/src/llua.cc @@ -214,8 +214,11 @@ inline bool file_exists(const char *path) { void llua_load(const char *script) { int error; - if (!file_exists(script)) { - NORM_ERR("llua_load: specified script file '%s' doesn't exist", script); + std::string path = to_real_path(script); + + if (!file_exists(path.c_str())) { + NORM_ERR("llua_load: specified script file '%s' doesn't exist", + path.c_str()); // return without initializing lua_L because other parts of the code rely // on it being null if the script is not loaded return; @@ -223,7 +226,6 @@ void llua_load(const char *script) { llua_init(); - std::string path = to_real_path(script); error = luaL_dofile(lua_L, path.c_str()); if (error != 0) { NORM_ERR("llua_load: %s", lua_tostring(lua_L, -1));