Hi everybody. Today a simple but useful script to uncompress a ZIP file in the current image directory. Notice the #ensure: send, Smalltalk provides an very elegant way to evaluate a termination block:
1 2 3 4 5 6 7 | | zipArchive fileRef | zipArchive := ZipArchive new. fileRef := 'myFile.zip' asFileReference. [ zipArchive readFrom: fileRef fullName; extractAllTo: FileSystem workingDirectory ] ensure: [ zipArchive close ]. |
0 comentarios:
Publicar un comentario