[Pkg] The Trunk: System-fbs.511.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jan 17 13:42:11 UTC 2013

Frank Shearar uploaded a new version of System to project The Trunk:

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

Name: System-fbs.511
Author: fbs
Time: 17 January 2013, 1:41:03.986 pm
UUID: 2880b77e-7f21-473e-b249-1159f33f640a
Ancestors: System-bf.510

Filenames like "3+4.st" are perfectly valid, but need to be URL encoded.

I would be happy to see a simpler implementation.

=============== Diff against System-bf.510 ===============

Item was changed:
  ----- Method: ProjectLauncher>>startUpAfterLogin (in category 'running') -----
  	| scriptName loader isUrl |
  	self setupFlaps.
  	Preferences readDocumentAtStartup ifTrue: [
  		HTTPClient isRunningInBrowser ifTrue:[
  			self setupFromParameters.
  			scriptName := self parameterAt: 'src'.
  			CodeLoader defaultBaseURL: (self parameterAt: 'Base').
  		] ifFalse:[
  			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 |
- 				isUrl ifFalse:[
  					"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]].
- 						resolveRelativeURI: scriptName) 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].

More information about the Packages mailing list