|
In the latest Pharo 7 build GZipReadStream class>>#unzip:to: results in an Invalid utf8 input detected error. In Pharo 6.1 it doesn't. Probably caused by the filestream changes of Pharo 7. Updating the method has fixed the issue for me:
unzip: fullFileName to: pathName
"Unzip the contents of the file specified by the full path name or file reference fullFileName to the location given by pathName.
GZipReadStream unzip:'/aPath/zip.gz' to: '/aPath'
GZipReadStream unzip:'zip.gz' to: '/aPath'
GZipReadStream unzip:'/aPath/zip.gz' asFileReference to: '/aPath' asFileReference
To unzip a .zip go to the class ZipArchive
"
| buffer newName |
newName := fullFileName asFileReference basename copyUpToLast: FileSystem disk extensionDelimiter.
pathName asFileReference ensureCreateDirectory / newName
binaryWriteStreamDo: [ :unzipped |
unzipped ifNil: [ self error: pathName , ' looks incorrect' ].
self
with: fullFileName asFileReference binaryReadStream
do: [ :zipped |
buffer := ByteArray new: 50000.
[ zipped atEnd ] whileFalse: [ unzipped nextPutAll: (zipped nextInto: buffer) ] ] ].
^ newName
|
|
|
Priority: 5 – Fix If Time
|
|
Status: Work Needed
|
|
Assigned to: Everyone
|
|
Milestone: Later
|
Go to Case
|
|