diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-02-27 16:39:16 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-02-27 16:39:16 -0300 |
commit | ef20bb14aced31cb11abad8d283426ba9578f25c (patch) | |
tree | 2bd50c26799cbf88efa3a17dc076d817bf185a67 | |
parent | b14d3f96bca39843b652a1a61f67968052a1b1a0 (diff) | |
parent | 659f8115d7c369d6dd65647be66fe6b180efc2e1 (diff) | |
download | luarocks-ef20bb14aced31cb11abad8d283426ba9578f25c.tar.gz luarocks-ef20bb14aced31cb11abad8d283426ba9578f25c.tar.bz2 luarocks-ef20bb14aced31cb11abad8d283426ba9578f25c.zip |
Merge pull request #235 from siffiejoe/unzip
handle implict subdirectories when unpacking with LuaZip
-rw-r--r-- | src/luarocks/fs/lua.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index ea16b728..9806bb63 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -498,6 +498,14 @@ function fs_lua.unzip(zipfile) | |||
498 | local ok, err = fs.make_dir(dir.path(fs.current_dir(), file.filename)) | 498 | local ok, err = fs.make_dir(dir.path(fs.current_dir(), file.filename)) |
499 | if not ok then return nil, err end | 499 | if not ok then return nil, err end |
500 | else | 500 | else |
501 | local base = dir.dir_name(file.filename) | ||
502 | if base ~= "" then | ||
503 | base = dir.path(fs.current_dir(), base) | ||
504 | if not fs.is_dir(base) then | ||
505 | local ok, err = fs.make_dir(base) | ||
506 | if not ok then return nil, err end | ||
507 | end | ||
508 | end | ||
501 | local rf, err = zipfile:open(file.filename) | 509 | local rf, err = zipfile:open(file.filename) |
502 | if not rf then zipfile:close(); return nil, err end | 510 | if not rf then zipfile:close(); return nil, err end |
503 | local contents = rf:read("*a") | 511 | local contents = rf:read("*a") |