On Apr 19, 2016, at 7:10 AM, Tudor Girba <tudor@tudorgirba.com> wrote:
The way I see it is that pathString can be anything that understands asFileReference. This means: - FileReference - Path - String
+1. So a better parameter name would be pathName or path. Parameter names that encode concrete types are sometimes appropriate and hence helpful, sometimes misleading. In this case it's misleading.
Doru
On Apr 19, 2016, at 2:54 PM, stepharo <stepharo@free.fr> wrote:
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
-- www.tudorgirba.com www.feenk.com
"We can create beautiful models in a vacuum. But, to get them effective we have to deal with the inconvenience of reality."