diff --git a/README.md b/README.md index 89b6d45..16043bf 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Based on http://wiki.tcl.tk/15158 - bit32 or bit - iconv (if not found then file names passed as is) - alien/ffi (on Windos detect system default codepage) -- lunit (only for test) +- lunitx (only for test) - [AesFileEncrypt] (https://github.com/moteus/lua-AesFileEncrypt) (optional) ## Supports ## @@ -33,6 +33,7 @@ function make_reader(fname) isdir = false, mtime = 1348048902, -- lfs.attributes('modification') exattrib = 32, -- get from GetFileAttributesA + platform = 'fat32', -- `exattrib` is platform dependent } return desc, desc.isfile and function() local chunk = f:read(chunk_size) @@ -88,7 +89,7 @@ ZipStream = ZipWriter.new{ ``` - - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/zipwriter/trend.png)](https://bitdeli.com/free "Bitdeli Badge") - + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/zipwriter/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + diff --git a/lakefile b/lakefile index dfa908b..10e95c2 100644 --- a/lakefile +++ b/lakefile @@ -1,3 +1,5 @@ +J = J or path.join + if LUA_VER == '5.2' then LUA_NEED = 'lua52' LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR diff --git a/lua/ZipWriter.lua b/lua/ZipWriter.lua index be2cd66..c981d1f 100644 --- a/lua/ZipWriter.lua +++ b/lua/ZipWriter.lua @@ -457,6 +457,7 @@ end -- @tfield number ctime -- @tfield number atime -- @tfield number exattrib on Windows it can be result of GetFileAttributes +-- @tfield string platform -- @tfield ?string data file content --- @@ -637,13 +638,18 @@ function ZipWriter:write( if use_aes then ver_made = ZIP_VERSION_EXTRACT["6.3"] -- @encrypt 7z do this else - ver_made = IS_WINDOWS and ZIP_VERSION_EXTRACT["2.0"] or ZIP_VERSION_EXTRACT["2.0"] + ver_made = ZIP_VERSION_EXTRACT["2.0"] end - local made_by_win - if not fileDesc.platform then made_by_win = IS_WINDOWS - else made_by_win = (fileDesc.platform:lower() == 'windows') end - ver_made = bit.bor( ver_made, made_by_win and ZIP_VERSION_MADE.FAT32 or ZIP_VERSION_MADE.UNIX ) + local platform_made = fileDesc.platform + if not platform_made then + platform_made = IS_WINDOWS and 'fat32' or 'unix' + elseif platform_made:lower() == 'windows' then + platform_made = 'fat32' -- for compatability + end + platform_made = ZIP_VERSION_MADE[platform_made:upper()] or ZIP_VERSION_MADE.UNIX + + ver_made = bit.bor( ver_made, platform_made ) if fileDesc.isfile then flags = bit.bor(flags, level.flag)