[squeak-dev] The Trunk: Kernel-mt.1433.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Dec 6 16:17:36 UTC 2021


Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1433.mcz

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

Name: Kernel-mt.1433
Author: mt
Time: 6 December 2021, 5:17:32.639211 pm
UUID: ffcbed5c-2a51-4342-a8f0-3ce8f9639dd9
Ancestors: Kernel-mt.1432

Hmpf. I forgot to commit this along with Tools-mt.1079. Let's see how this goes now...

=============== Diff against Kernel-mt.1432 ===============

Item was removed:
- ----- Method: Model>>cleanFileNameForSave: (in category 'user interface - file out') -----
- cleanFileNameForSave: aString
- 	"Removes selected decoration (i.e., leader+trailer) of aString. This decoration usually comes from window titles and the desire to reuse those titles as a file name.
- 	NOTE THAT if only the decoration's leader matches, any existing file extension will be removed.
- 	NOTE THAT if no decoration matches, the '.text' extension is appended if there is none.
- 	SEE #defaultFileNameForSave."
- 
- 	| cleanFileName |
- 	self flag: #discuss. "mt: Rename 'save' to 'fileOut'?"
- 	cleanFileName := aString.
- 
- 	#( " 'leader' 'trailer' "
- 		'Decompressed contents of: ' '.gz'
- 		"Add more here..."
- 	) groupsDo: [:leader :trailer |
- 		self flag: #discuss. "mt: Maybe extract this feature into String and Text? See #withoutLeading* and #withoutTrailing*."
- 		(cleanFileName beginsWith: leader) ifTrue: [
- 			cleanFileName := cleanFileName allButFirst: leader size.
- 			(cleanFileName endsWith: trailer)
- 				ifTrue: [cleanFileName := cleanFileName allButLast: trailer size]
- 				ifFalse: [
- 					| lastIndex |
- 					lastIndex := cleanFileName lastIndexOf: $. ifAbsent: [0].
- 					lastIndex > 1 ifTrue: [
- 						cleanFileName := cleanFileName copyFrom: 1 to: lastIndex - 1]] ]].
- 
- 	(cleanFileName = aString and: [(cleanFileName includes: $.) not])
- 		ifTrue: [cleanFileName := cleanFileName, '.text'].
- 
- 	^ cleanFileName!

Item was removed:
- ----- Method: Model>>defaultFileNameForSave (in category 'user interface - file out') -----
- defaultFileNameForSave
- 	"Answer a label that should be used as a file name when saving the receivers textual contents to disk. Note that the answer can also be a relative or absolute file path."
- 	
- 	self flag: #discuss. "mt: Rename 'save' to 'fileOut'?"
- 	^ self containingWindow
- 		ifNil: ['Untitled']
- 		ifNotNil: [:window | window label]!

Item was removed:
- ----- Method: Model>>saveContents: (in category 'user interface - file out') -----
- saveContents: stringContents
- 	"Interactive. See #saveContents:accessMode:."
- 
- 	^ 	self
- 		saveContents: stringContents
- 		accessMode: #create!

Item was removed:
- ----- Method: Model>>saveContents:accessMode: (in category 'user interface - file out') -----
- saveContents: stringContents accessMode: accessMode
- 	"Interactive callback from TextEditor. Ask the user for a file name/path, suggesting a (cleaned-up) default name to accept. Answers whether the save request was successful."
- 
- 	^ (Project uiManager
- 		saveFilenameRequest: 'Save text contents in file...'
- 		initialAnswer: self suggestedFileNameForSave)
- 			ifNil: [false] ifNotNil: [:answer | answer ifEmpty: [false]
- 			ifNotEmpty: [:fileName |
- 				self
- 					saveContents: stringContents
- 					onFileNamed: fileName
- 					accessMode: accessMode]].!

Item was removed:
- ----- Method: Model>>saveContents:onFileNamed:accessMode: (in category 'user interface - file out') -----
- saveContents: stringContents onFileNamed: fileName accessMode: accessMode
- 	
- 	^ self
- 		saveContents: stringContents
- 		onFileNamed: fileName
- 		accessMode: accessMode
- 		workBlock: [:fileStream | fileStream nextPutAll: stringContents]!

Item was removed:
- ----- Method: Model>>saveContents:onFileNamed:accessMode:workBlock: (in category 'user interface - file out') -----
- saveContents: stringContents onFileNamed: fileName accessMode: accessMode workBlock: workBlock
- 	"Save stringContents on fileName. Answers whether the save request was successful. On success, fileName will exist, including any new directories in the relative/absolute path.
- 	
- 	accessMode
- 		#create	... Prompt the user if file exists.
- 		#update	... Replace all contents if file exists.
- 		#append	... Append new contents if file exists."
- 	
- 	(FileDirectory default on: fileName) containingDirectory assureExistence.
- 	accessMode caseOf: {
- 		[#create] -> [FileStream newFileNamed: fileName do: workBlock].
- 		[#update] -> [FileStream forceNewFileNamed: fileName do: workBlock].
- 		[#append] -> [FileStream fileNamed: fileName do: [:s | s setToEnd. workBlock value: s]] }
- 			otherwise: [
- 				self error: 'Unknown file access mode: ', accessMode printString.
- 				^ false].
- 			
- 	Transcript showln: ('{1} contents saved (via {2}) to: {3}' format: { self class. accessMode printString. fileName }).
- 	^ true!

Item was removed:
- ----- Method: Model>>suggestedFileNameForSave (in category 'user interface - file out') -----
- suggestedFileNameForSave
- 
- 	^ self cleanFileNameForSave: self defaultFileNameForSave!



More information about the Squeak-dev mailing list