diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-02-25 17:50:42 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-02-25 17:50:42 -0500 |
commit | ad23c29eb4178fc3b5a39b777a78443bef9c5ba7 (patch) | |
tree | bf457721e33f4f479d8c00664f2bb0355b95d65f /src | |
parent | 59a3d0b59c3e35d1eb9a3d11c40afc02e974fe34 (diff) | |
parent | b4931cb618a2b4d22482694cbc40e60990d684fc (diff) | |
download | lite-xl-plugin-manager-ad23c29eb4178fc3b5a39b777a78443bef9c5ba7.tar.gz lite-xl-plugin-manager-ad23c29eb4178fc3b5a39b777a78443bef9c5ba7.zip |
Merge branch 'master' of github.com:adamharrison/lite-xl-plugin-managerv1.2.0
Diffstat (limited to 'src')
-rw-r--r-- | src/lpm.c | 11 | ||||
-rw-r--r-- | src/lpm.lua | 4 |
2 files changed, 9 insertions, 6 deletions
@@ -820,6 +820,9 @@ static int lpm_extract(lua_State* L) { int has_ext_before = 0; int has_ext_allways = 0; + mtar_clear_header(&before_h); + mtar_clear_header(&allways_h); + while ((mtar_read_header(&tar, &h)) != MTAR_ENULLRECORD ) { if (h.type == MTAR_TREG) { @@ -839,7 +842,6 @@ static int lpm_extract(lua_State* L) { return luaL_error(L, "can't extract tar archive file %s, can't create directory %s: %s", src, target, strerror(errno)); } - char buffer[8192]; FILE* file = fopen(target, "wb"); if (!file) { mtar_close(&tar); @@ -848,7 +850,8 @@ static int lpm_extract(lua_State* L) { if (chmod(target, h.mode)) return luaL_error(L, "can't extract tar archive file %s, can't chmod file %s: %s", src, target, strerror(errno)); - + + char buffer[8192]; int remaining = h.size; while (remaining > 0) { int read_size = remaining < sizeof(buffer) ? remaining : sizeof(buffer); @@ -926,7 +929,7 @@ static int lpm_extract(lua_State* L) { if (mtar_read_data(&tar, before_h.name, read_size) != MTAR_ESUCCESS) { mtar_close(&tar); return luaL_error(L, "Error while reading GNU extended: %s", strerror(errno)); - } + } } else if (h.type == MTAR_TGLP) { @@ -936,7 +939,7 @@ static int lpm_extract(lua_State* L) { if (mtar_read_data(&tar, before_h.linkname, read_size) != MTAR_ESUCCESS) { mtar_close(&tar); return luaL_error(L, "Error while reading GNU extended: %s", strerror(errno)); - } + } } mtar_next(&tar); diff --git a/src/lpm.lua b/src/lpm.lua index 8ebe33f..8638efe 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1379,7 +1379,7 @@ function Bottle:construct() end -- atomically move things common.rmrf(local_path) - common.mkdirp(local_path) + common.mkdirp(common.dirname(local_path)) common.rename(self.local_path, local_path) self.local_path = local_path end @@ -1393,7 +1393,7 @@ end function Bottle:run(args) args = args or {} if self.is_system then error("system bottle cannot be run") end - local path = self.local_path .. PATHSEP .. "lite-xl" + local path = self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION if not system.stat(path) then error("cannot find bottle executable " .. path) end os.execute(path .. (#args > 0 and " " or "") .. table.concat(args, " ")) end |