[Cuis-dev] [Fix] ZipArchive>>#addFile: failure
Gerald Klix
cuis.01 at klix.ch
Sat Apr 10 04:50:04 PDT 2021
Hi all, Hi Juan,
ZipArchive>>#addFile: and
ZipArchive>>#addFile:as: do not work due to
a bug in MSDOS date handling.
Please find a script to reproduce that failure
and q fix to the compression package
attached to this message.
HTH and Best Regards,
Gerald
-------------- next part --------------
'From Haver 5.0 [latest update: #4552] on 9 April 2021 at 9:22:42 pm'!
!ZipArchiveMember methodsFor: 'private' stamp: 'KLG 4/9/2021 21:22:18'!
squeakToDosTime: secs
"Convert to MS-DOS time format
See: https://docs.microsoft.com/de-de/windows/win32/api/winbase/nf-winbase-dosdatetimetofiletime?redirectedfrom=MSDN
"
| dosTime dateTime |
dateTime _ Time dateAndTimeFromSeconds: secs secondsSinceSqueakEpoch.
dosTime _ (dateTime second second) bitShift: -1.
dosTime _ dosTime bitOr: ((dateTime second minute) bitShift: 5).
dosTime _ dosTime bitOr: ((dateTime second hour) bitShift: 11).
dosTime _ dosTime bitOr: ((dateTime first dayOfMonth) bitShift: `16 + 0`).
dosTime _ dosTime bitOr: ((dateTime first monthIndex) bitShift: `16 + 5`).
dosTime _ dosTime bitOr: (((dateTime first yearNumber) - 1980) bitShift: `16 + 9`).
self assert: dosTime >= 0.
^ dosTime
! !
-------------- next part --------------
Feature require: 'Compression'.
za _ ZipArchive new.
za addFile: Smalltalk vmFileName
More information about the Cuis-dev
mailing list