[squeak-dev] The Trunk: Tools-nice.521.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 13 20:30:51 UTC 2014


Nicolas Cellier uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-nice.521.mcz

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

Name: Tools-nice.521
Author: nice
Time: 13 May 2014, 10:29:52.892 pm
UUID: 33d41589-c752-4fa3-9387-2b8b0a8c942b
Ancestors: Tools-nice.520

Fix issue http://bugs.squeak.org/view.php?id=5504
Saving as a different file name in FileList does incorrectly update text contents to directory contents rather than file contents...
Thanks sumim, 8 years for this report to be taken into account, and 4 years for the fix to get accepted, a chance that it did not rot!

=============== Diff against Tools-nice.520 ===============

Item was changed:
  ----- Method: FileList>>put: (in category 'private') -----
  put: aText
  	"Private - put the supplied text onto the file"
  
+ 	| ff type newName |
- 	| ff type |
  	brevityState == #fullFile ifTrue:
  		[ff := directory newFileNamed: self fullName.
  		Cursor write showWhile: [ff nextPutAll: aText asString; close].
+ 		(directory = ff directory and: [fileName = ff localName])
- 		fileName = ff localName 
  			ifTrue: [contents := aText asString]
+ 			ifFalse: 		"user changed the directory and/or renamed the file"
+ 				[self clearUserEditFlag.
+ 				directory ~= ff directory ifTrue: 
+ 					[self directory: ff directory.
+ 					self changed: #rootDirectoryList; changed: #selectedPath].
+ 				self updateFileList.
+ 				contents := aText asString.
+ 				newName := ff localName.
+ 				listIndex := list findFirst: [:item | (self fileNameFromFormattedItem: item) = newName].
+ 				listIndex > 0 ifTrue: [fileName := newName].
+ 				brevityState := #needToGetBrief.
+ 				self changed: #fileListIndex].
+ 		self changed: #relabel.
- 			ifFalse: [self updateFileList].		"user renamed the file"
  		^ true  "accepted"].
  
  	listIndex = 0 ifTrue:
  		[self inform: 'No fileName is selected' translated.
  		^ false  "failed"].
  	type := 'These'.
  	brevityState = #briefFile ifTrue: [type := 'Abbreviated'].
  	brevityState = #briefHex ifTrue: [type := 'Abbreviated'].
  	brevityState = #fullHex ifTrue: [type := 'Hexadecimal'].
  	brevityState = #FileList ifTrue: [type := 'Directory'].
  	self inform: ('{1} contents cannot
  meaningfully be saved at present.' translated format:{type translated}).
  	^ false  "failed"
  !



More information about the Squeak-dev mailing list