[squeak-dev] The Inbox: System-laza.423.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Feb 22 10:31:54 UTC 2011
Alexander Lazarević uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-laza.423.mcz
==================== Summary ====================
Name: System-laza.423
Author: laza
Time: 22 February 2011, 11:31:19.136 am
UUID: 2c296259-64d4-499d-b4b5-9a4046d737fa
Ancestors: System-ul.422
Add support for accessing OS environment variables (on linux at first)
=============== Diff against System-ul.422 ===============
Item was added:
+ ----- Method: SmalltalkImage>>environ (in category 'os') -----
+ environ
+ "Smalltalk os environ"
+ | env c in match out name |
+ env := IdentityDictionary new.
+ self os osVersion = 'linux' ifFalse: [^env]. "Currently only supported on linux"
+ in := FileStream oldFileOrNoneNamed: '/proc/self/environ'.
+ in ifNil: [^env].
+ out := WriteStream on: String new.
+ match := $=.
+ [(c := in next) isNil] whileFalse: [
+ c = match
+ ifTrue: [
+ c = $= ifTrue: [name := out contents. match := 0 asCharacter].
+ c = 0 asCharacter ifTrue: [env at: name asSymbol put: out contents. match := $=].
+ out reset]
+ ifFalse: [out nextPut: c]].
+ ^env!
Item was added:
+ ----- Method: SmalltalkImage>>getEnv: (in category 'os') -----
+ getEnv: name
+ "Smalltalk os getEnv: 'HOME'"
+ ^self os environ at: name asSymbol ifAbsent: [nil]
+ !
More information about the Squeak-dev
mailing list
|