diff --git a/src/zippy/internal.nim b/src/zippy/internal.nim index 8515434..8673503 100644 --- a/src/zippy/internal.nim +++ b/src/zippy/internal.nim @@ -110,16 +110,16 @@ const 16.uint8, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ] - S_IFDIR* = 0o0040000 - TUREAD* = 0o00400 # read by owner */ - TUWRITE* = 0o00200 # write by owner */ - TUEXEC* = 0o00100 # execute/search by owner */ - TGREAD* = 0o00040 # read by group */ - TGWRITE* = 0o00020 # write by group */ - TGEXEC* = 0o00010 # execute/search by group */ - TOREAD* = 0o00004 # read by other */ - TOWRITE* = 0o00002 # write by other */ - TOEXEC* = 0o00001 # execute/search by other */ + S_IFDIR* = 0o0040000'u32 + TUREAD* = 0o00400'u32 # read by owner */ + TUWRITE* = 0o00200'u32 # write by owner */ + TUEXEC* = 0o00100'u32 # execute/search by owner */ + TGREAD* = 0o00040'u32 # read by group */ + TGWRITE* = 0o00020'u32 # write by group */ + TGEXEC* = 0o00010'u32 # execute/search by group */ + TOREAD* = 0o00004'u32 # read by other */ + TOWRITE* = 0o00002'u32 # write by other */ + TOEXEC* = 0o00001'u32 # execute/search by other */ type CompressionConfig* = object @@ -272,7 +272,7 @@ proc determineMatchLength*( proc toUnixPath*(path: string): string = path.replace('\\', '/') -proc parseFilePermissions*(permissions: int): set[FilePermission] = +proc parseFilePermissions*(permissions: uint32): set[FilePermission] = if defined(windows) or permissions == 0: # Ignore file permissions on Windows. If they are absent (.zip made on # Windows for example), set default permissions. diff --git a/src/zippy/tarballs.nim b/src/zippy/tarballs.nim index 29e96dc..28ae1d2 100644 --- a/src/zippy/tarballs.nim +++ b/src/zippy/tarballs.nim @@ -102,7 +102,10 @@ proc extractAll*( dest / path, uncompressed.toOpenArray(pos, max(pos + size - 1, 0)) ) - setFilePermissions(dest / path, parseFilePermissions(mode)) + setFilePermissions( + dest / path, + parseFilePermissions(cast[uint32](mode)) + ) lastModifiedTimes.add (path, initTime(mtime, 0)) elif typeflag == '5': # Directories createDir(dest / path) diff --git a/src/zippy/tarballs_v1.nim b/src/zippy/tarballs_v1.nim index 7e24c01..3bda7ec 100644 --- a/src/zippy/tarballs_v1.nim +++ b/src/zippy/tarballs_v1.nim @@ -145,7 +145,7 @@ proc openStreamImpl( kind: ekNormalFile, contents: data[pos ..< pos + fileSize], lastModified: initTime(lastModified, 0), - permissions: parseFilePermissions(fileMode), + permissions: parseFilePermissions(cast[uint32](fileMode)), ) elif typeFlag == '5': tarball.contents[(fileNamePrefix / fileName).toUnixPath()] = diff --git a/src/zippy/ziparchives.nim b/src/zippy/ziparchives.nim index ce31394..ccc58a9 100644 --- a/src/zippy/ziparchives.nim +++ b/src/zippy/ziparchives.nim @@ -383,7 +383,7 @@ proc openZipArchive*( compressedSize: compressedSize, uncompressedSize: uncompressedSize, uncompressedCrc32: uncompressedCrc32, - filePermissions: parseFilePermissions((externalFileAttr.uint shr 16).int) + filePermissions: parseFilePermissions(externalFileAttr shr 16) ) except IOError as e: result.close() diff --git a/zippy.nimble b/zippy.nimble index 0e19813..e89e455 100644 --- a/zippy.nimble +++ b/zippy.nimble @@ -1,4 +1,4 @@ -version = "0.10.15" +version = "0.10.16" author = "Ryan Oldenburg" description = "Pure Nim implementation of deflate, zlib, gzip and zip." license = "MIT"