Le 19/4/16 15:53, Valentin Ryckewaert a ��crit��:
I mean, fileRef basename is myZip.zip and workingDirectory is the place files will go after being unziped but how does we find the file named fileRef basename ?


'foo.txt' asFileReference -> a fileRef

'foo.txt' asFileReference basename.

(FileSystem disk workingDirectory / 'foo.txt') basename

this is explained in the File chapter.


Can you open a bug entry to improve the comment of the method?

2016-04-19 15:46 GMT+02:00 stepharo <stepharo@free.fr>:


Le 19/4/16 15:41, Valentin Ryckewaert a ��crit��:
How does unzip:to: access to the file ?
I do not get your question?
It must be in the workingDirectory?

Read the code luke....


unzip: fullFileName to: pathString
�� �� "Unzip the contents of the file specified by the full path name fullFileName to the location given by pathString."

�� �� | zipped buffer unzipped newName |
�� �� newName := fullFileName copyUpToLast: FileSystem disk extensionDelimiter.
�� �� pathString asFileReference ensureCreateDirectory.
�� �� unzipped := FileStream newFileNamed: (pathString asFileReference / newName) fullName.
������ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



�� �� unzipped ifNil: [self error: pathString, ' looks incorrect'].
�� �� [ unzipped binary.
�� �� zipped := self on: (FileStream readOnlyFileNamed: fullFileName).
�� �� buffer := ByteArray new: 50000.
�� �� [zipped atEnd] whileFalse: [unzipped nextPutAll: (zipped nextInto: buffer)]]
�� �� �� �� ensure: [
�� �� �� �� �� �� zipped close.
�� �� �� �� �� �� unzipped close].
�� �� ^ newName





2016-04-19 15:06 GMT+02:00 Hern��n Morales Durand <hernan.morales@gmail.com>:
I use it a lot to uncompress external resources like this:

fileRef := ....
GZipReadStream unzip: fileRef basename to: FileSystem workingDirectory.

but it could be used to pass a directory as String I guess.
Comment should be corrected.


2016-04-19 9:54 GMT-03:00 stepharo <stepharo@free.fr>:
unzip: fullFileName to: pathString
�� �� "Unzip the contents of the file specified by the full path name fullFileName to the location given by pathString."

so we would expect to pass a string in the second argument?

the unique sender of it in the system

unzip: fullFileName
�� �� "Unzip the contents of a gzipped file specified by its full file name to the current working directory"

�� �� ^ self unzip: fullFileName to: FileSystem disk workingDirectory


but the implementation seems to indicate that fullFileName is should be a string as well as pathString

unzip: fullFileName to: pathString
�� �� "Unzip the contents of the file specified by the full path name fullFileName to the location given by pathString."

�� �� | zipped buffer unzipped newName |
�� �� newName := fullFileName copyUpToLast: FileSystem disk extensionDelimiter.
�� �� pathString asFileReference ensureCreateDirectory.
�� �� unzipped := FileStream newFileNamed: (pathString asFileReference / newName) fullName.
�� �� unzipped ifNil: [self error: pathString, ' looks incorrect'].
�� �� [ unzipped binary.
�� �� zipped := self on: (FileStream readOnlyFileNamed: fullFileName).
�� �� buffer := ByteArray new: 50000.
�� �� [zipped atEnd] whileFalse: [unzipped nextPutAll: (zipped nextInto: buffer)]]
�� �� �� �� ensure: [
�� �� �� �� �� �� zipped close.
�� �� �� �� �� �� unzipped close].
�� �� ^ newName

Am I correct to think that the comments are not really good enough?

Stef