1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 10:05:22 +00:00

Fix regression in lua_load path handling

This should resolve #1778 (and similar issues).
This commit is contained in:
Brenden Matthews 2024-03-09 18:27:30 -05:00
parent 26384446fa
commit 755e8c3e10

View File

@ -214,8 +214,11 @@ inline bool file_exists(const char *path) {
void llua_load(const char *script) { void llua_load(const char *script) {
int error; int error;
if (!file_exists(script)) { std::string path = to_real_path(script);
NORM_ERR("llua_load: specified script file '%s' doesn't exist", 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 // return without initializing lua_L because other parts of the code rely
// on it being null if the script is not loaded // on it being null if the script is not loaded
return; return;
@ -223,7 +226,6 @@ void llua_load(const char *script) {
llua_init(); llua_init();
std::string path = to_real_path(script);
error = luaL_dofile(lua_L, path.c_str()); error = luaL_dofile(lua_L, path.c_str());
if (error != 0) { if (error != 0) {
NORM_ERR("llua_load: %s", lua_tostring(lua_L, -1)); NORM_ERR("llua_load: %s", lua_tostring(lua_L, -1));