[squeak-dev] The Inbox: System-dtl.1197.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 13 04:53:27 UTC 2020


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

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

Name: System-dtl.1197
Author: dtl
Time: 12 December 2020, 11:39:02.946469 pm
UUID: 98a9eb0b-d360-473f-a718-f1f7ae883ac7
Ancestors: System-mt.1196

Enable removal of preference for 'Read document at startup'.

Simplify code such that #readDocumentAtStartup is assumed always true and document specifiers begining with '-' are not treated as start documents. The actual preference setting is no longer referenced.

Assumptions: if the start document resource name starts with '-' then it is unlikely to be a document. For the case of the first argument appearing to be a document but the user wishing to use it otherwise, the '--' token (or any other argument beginning with '-') may be used in the command line to protect the argument from evaluation. This allows the traditional start document processing to work normally in the general case, and allows start document processing to be bypassed from the command line if desired. No preference setting is required. 

The #readDocumentAtStartup may be removed in a future update.

=============== Diff against System-mt.1196 ===============

Item was changed:
  ----- Method: ProjectLauncher>>startUpAfterLogin (in category 'running') -----
  startUpAfterLogin
  	| scriptName loader isUrl |
  	self setupFlaps.
+ 	Smalltalk firstArgMightBeDocument
+ 		ifTrue: [scriptName := Smalltalk documentPath.
- 	Preferences readDocumentAtStartup
- 		ifTrue: [scriptName := Smalltalk documentPath
- 						ifNil: [''].
  			scriptName := scriptName convertFromSystemString.
  			scriptName isEmpty
  				ifFalse: ["figure out if script name is a URL by itself"
  					isUrl := (scriptName asLowercase beginsWith: 'http://')
  								or: [(scriptName asLowercase beginsWith: 'file://')
  										or: [scriptName asLowercase beginsWith: 'ftp://']].
  					isUrl
  						ifFalse: [| encodedPath pathTokens |
  							"Allow for ../dir/scriptName arguments"
  							pathTokens := scriptName splitBy: FileDirectory slash.
  							pathTokens := pathTokens
  										collect: [:s | s encodeForHTTP].
  							encodedPath := pathTokens
  										reduce: [:acc :each | acc , FileDirectory slash , each].
  							scriptName := (FileDirectory default uri resolveRelativeURI: encodedPath) asString]]]
  		ifFalse: [scriptName := ''].
  	scriptName isEmptyOrNil
  		ifTrue: [^ Preferences eToyFriendly
  				ifTrue: [self currentWorld addGlobalFlaps]].
  	loader := CodeLoader new.
  	loader
  		loadSourceFiles: (Array with: scriptName).
  	(scriptName asLowercase endsWith: '.pr')
  		ifTrue: [self installProjectFrom: loader]
  		ifFalse: [loader installSourceFiles]!

Item was changed:
  ----- Method: SmalltalkImage>>arguments (in category 'command line') -----
  arguments
  	"Answer an array with all the command line arguments.
+ 	This does not include imagePath, documentPath nor any option.
+ 	The '--' token on the command line indicates that remaining arguments should
+ 	be passed to the image without interpretation, and should not be treated as e.g.
+ 	specification of a start script." 
+ 
- 	This does not include imagePath, documentPath nor any option."
- 	
  	"Smalltalk commandLine arguments"
  	
+ 	| args |
- 	| args strm |
  	args := self rawArguments.
+ 	(args includes: '--' )
+ 		ifTrue: [ ^ args copyAfter: '--' ]
+ 		ifFalse: [ | rs | rs := args readStream.
+ 			rs next. "skip image name"
+ 			self firstArgMightBeDocument
+ 				ifTrue: [rs next "skip startup document name"].
+ 			^ rs upToEnd ].
- 	(args includes: '--')
- 		ifTrue: [ ^args copyAfter: self imageArgumentsMarker ].
- 	strm := args readStream.
- 	strm atEnd ifFalse: [ strm next. "skip image name"
- 		(Preferences readDocumentAtStartup and: [ strm atEnd not ])
- 			ifTrue: [ strm next "skip startup document name" ]].
- 	^ strm upToEnd.
  !

Item was changed:
  ----- Method: SmalltalkImage>>documentPath (in category 'command line') -----
  documentPath
  	"Answer the absolute path of the document passed to the VM or nil if none."
  	"Smalltalk commandLine documentPath"
+ 	^ (self getSystemAttribute: 2) ifNil: [ '' ]
- 	^ (self getSystemAttribute: 2)
- 		ifNotNil: [ :arg | arg = self imageArgumentsMarker
- 			ifTrue: [nil] ifFalse: [arg]].
- 
  !

Item was added:
+ ----- Method: SmalltalkImage>>firstArgMightBeDocument (in category 'private') -----
+ firstArgMightBeDocument
+ 	"If the first argument begins with '-' then it is unlikely to be a document specification"
+ 	^ (self documentPath beginsWith: '-') not
+ !

Item was removed:
- ----- Method: SmalltalkImage>>imageArgumentsMarker (in category 'command line') -----
- imageArgumentsMarker
- 	"The '--' token on the command line indicates that remaining arguments should
- 	be passed to the image without interpretation, and should not be treated as e.g.
- 	specification of a start script." 
- 
- 	^ '--'!



More information about the Squeak-dev mailing list