The Inbox: System-kfr.1161.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: System-kfr.1161.mcz

commits-2
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-kfr.1161.mcz

==================== Summary ====================

Name: System-kfr.1161
Author: kfr
Time: 4 June 2020, 11:05:51.49313 pm
UUID: 38776d4a-508a-7044-ab72-4cb34ceaceea
Ancestors: System-mt.1160

Return nil instead of opening pre debugger

=============== Diff against System-mt.1160 ===============

Item was changed:
  ----- Method: StandardFileStream class>>fileExistsUserHandling:ifDebug: (in category '*System-Files-error handling') -----
  fileExistsUserHandling: fullFileName ifDebug: debugBlock
  | dir localName choice newName newFullFileName |
  dir := FileDirectory forFileName: fullFileName.
  localName := FileDirectory localNameFor: fullFileName.
  choice := (UIManager default
  chooseFrom: #('overwrite that file' 'append (risky!!!!)' 'choose another name' 'debug' 'cancel')
  title: localName, ' already exists.').
 
  choice = 1 ifTrue: [
  dir deleteFileNamed: localName
  ifAbsent: [self error: 'Could not delete the old version of that file'].
  ^ self new open: fullFileName forWrite: true].
 
  choice = 2 ifTrue: [
  ^ (self new open: fullFileName forWrite: true) setToEnd].
 
  choice = 3 ifTrue: [
  newName := UIManager default request: 'Enter a new file name' initialAnswer: fullFileName.
  newFullFileName := self fullName: newName.
  ^ self newFileNamed: newFullFileName].
 
  choice = 4 ifTrue: [^ debugBlock value].
 
+ choice = 5 ifTrue: [^ nil].!
- self error: 'Please close this to abort file opening'!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-kfr.1161.mcz

marcel.taeumel
Hi Karl, hi all!

So, this is proposing to virtually turn a FileExistsException into an ignored Notification if the user cancels the request. There are only 5 users in a recent Trunk image. Those don't seem to handle the ifNil-case very well. Other debuggers could appear and obfuscate the actual issue.

I will move this to "treated" because it does not work.

(Note that there is currently no easy way to cancel the control flow without opening a debugger that would work in Morphic and MVC. Would be a nice addition to ToolSet, though.)

Best,
Marcel

Am 04.06.2020 23:06:11 schrieb [hidden email] <[hidden email]>:

A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-kfr.1161.mcz

==================== Summary ====================

Name: System-kfr.1161
Author: kfr
Time: 4 June 2020, 11:05:51.49313 pm
UUID: 38776d4a-508a-7044-ab72-4cb34ceaceea
Ancestors: System-mt.1160

Return nil instead of opening pre debugger

=============== Diff against System-mt.1160 ===============

Item was changed:
----- Method: StandardFileStream class>>fileExistsUserHandling:ifDebug: (in category '*System-Files-error handling') -----
fileExistsUserHandling: fullFileName ifDebug: debugBlock
| dir localName choice newName newFullFileName |
dir := FileDirectory forFileName: fullFileName.
localName := FileDirectory localNameFor: fullFileName.
choice := (UIManager default
chooseFrom: #('overwrite that file' 'append (risky!!!!)' 'choose another name' 'debug' 'cancel')
title: localName, ' already exists.').

choice = 1 ifTrue: [
dir deleteFileNamed: localName
ifAbsent: [self error: 'Could not delete the old version of that file'].
^ self new open: fullFileName forWrite: true].

choice = 2 ifTrue: [
^ (self new open: fullFileName forWrite: true) setToEnd].

choice = 3 ifTrue: [
newName := UIManager default request: 'Enter a new file name' initialAnswer: fullFileName.
newFullFileName := self fullName: newName.
^ self newFileNamed: newFullFileName].

choice = 4 ifTrue: [^ debugBlock value].

+ choice = 5 ifTrue: [^ nil].!
- self error: 'Please close this to abort file opening'!