[squeak-dev] The Trunk: Compression-tpr.62.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Apr 19 18:39:49 UTC 2022
tim Rowledge uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-tpr.62.mcz
==================== Summary ====================
Name: Compression-tpr.62
Author: tpr
Time: 19 April 2022, 11:39:48.020688 am
UUID: 5b14cf22-3ae7-48ed-8cf5-33322b5a579c
Ancestors: Compression-dtl.61
Use the new ToolBuilder ability to show a list of options - typically a small number, maybe with a cancel button etc - as opposed to an arbitrary list of values. This separates it out from the chooseFrom:... protocol.
Also update "UIManager default" with "Project uiManager"
=============== Diff against Compression-dtl.61 ===============
Item was changed:
----- Method: ZipArchiveMember>>extractInDirectory:overwrite: (in category 'extraction') -----
extractInDirectory: aDirectory overwrite: overwriteAll
"Extract this entry into the given directory. Answer #okay, #failed, #abort, or #retryWithOverwrite."
| path fileDir file index localName |
path := fileName findTokens:'/'.
localName := path last.
+ fileDir := path allButLast
+ inject: aDirectory
+ into:
+ [:base :part|
+ base directoryNamed: part].
- fileDir := path allButLast inject: aDirectory into:[:base :part| base directoryNamed: part].
fileDir assureExistence.
+ file := [fileDir newFileNamed: localName]
+ on: FileExistsException
+ do:
+ [:ex|
+ ex return: nil].
+ file ifNil:
+ [overwriteAll ifFalse:
+ [[index := Project uiManager
+ chooseOptionFrom: "<-- needs simpler dialogue with a proper cancle button"
+ {'Yes, overwrite'.
+ 'No, don''t overwrite'.
+ 'Overwrite ALL files'.
+ 'Cancel operation'}
+ lines: #(2)
+ title: fileName, ' already exists. Overwrite?'.
- file := [fileDir newFileNamed: localName] on: FileExistsException do:[:ex| ex return: nil].
- file ifNil:[
- overwriteAll ifFalse:[
- [index := UIManager default chooseFrom: {
- 'Yes, overwrite'.
- 'No, don''t overwrite'.
- 'Overwrite ALL files'.
- 'Cancel operation'
- } lines: #(2) title: fileName, ' already exists. Overwrite?'.
index == nil] whileTrue.
index = 4 ifTrue:[^#abort].
index = 3 ifTrue:[^#retryWithOverwrite].
index = 2 ifTrue:[^#okay].
].
+ file := [fileDir forceNewFileNamed: localName]
+ on: Error
+ do:
+ [:ex| ex return].
- file := [fileDir forceNewFileNamed: localName] on: Error do:[:ex| ex return].
file ifNil:[^#failed].
].
self extractTo: file.
file close.
^#okay!
More information about the Squeak-dev
mailing list
|