aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.c
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-01-11 21:47:54 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-01-11 21:47:54 -0500
commit46bf49a25bd772413576d26e8a80020aaae7c9dd (patch)
treea5f2f1889b62691e98062e19183d3c4faf48b765 /src/lpm.c
parentb371dcb9903266bf5ff15d6a97c02f7b1233d878 (diff)
downloadlite-xl-plugin-manager-46bf49a25bd772413576d26e8a80020aaae7c9dd.tar.gz
lite-xl-plugin-manager-46bf49a25bd772413576d26e8a80020aaae7c9dd.zip
Fixed error handling, and fixed plugin difference call.
Diffstat (limited to 'src/lpm.c')
-rw-r--r--src/lpm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lpm.c b/src/lpm.c
index b23d3fe..8ad385d 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -943,6 +943,7 @@ static int lpm_pwd(lua_State* L) {
int lpm_flock(lua_State* L) {
const char* path = luaL_checkstring(L, 1);
luaL_checktype(L, 2, LUA_TFUNCTION);
+ int error_handler = lua_type(L, 3) == LUA_TFUNCTION ? 3 : 0;
#ifdef _WIN32
HANDLE file = CreateFileW(lua_toutf16(L, path), FILE_SHARE_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if (!file || file == INVALID_HANDLE_VALUE)
@@ -963,7 +964,7 @@ int lpm_flock(lua_State* L) {
#endif
lua_pushvalue(L, 2);
lua_pushvalue(L, 1);
- int err = lua_pcall(L, 1, 0, 0);
+ int err = lua_pcall(L, 1, 0, error_handler);
#ifdef _WIN32
UnlockFile(file, 0, 0, 1, 0);
CloseHandle(file);