From f9a3a4df9874737013897ed7b15aeb6ec3969f09 Mon Sep 17 00:00:00 2001 From: Wires77 Date: Fri, 29 Mar 2024 16:07:55 -0500 Subject: [PATCH] Properly handle returned value for RemoveDir --- ui_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui_api.cpp b/ui_api.cpp index a888321..2ab779b 100644 --- a/ui_api.cpp +++ b/ui_api.cpp @@ -1106,7 +1106,7 @@ static int l_RemoveDir(lua_State* L) ui->LAssert(L, lua_isstring(L, 1), "l_RemoveDir() argument 1: expected string, got %s", luaL_typename(L, 1)); std::filesystem::path path(lua_tostring(L, 1)); std::error_code ec; - if (!is_directory(path, ec) || ec || remove(path, ec) || ec) { + if (!is_directory(path, ec) || ec || !remove(path, ec) || ec) { lua_pushnil(L); lua_pushstring(L, strerror(ec.value())); return 2;