[squeak-dev] Squeak equivalent of OSPlatform ?

Levente Uzonyi leves at caesar.elte.hu
Tue Oct 20 22:34:05 UTC 2020


Hi Tim,

On Tue, 20 Oct 2020, gettimothy via Squeak-dev wrote:

> Hi folks,
> 
> I am puttering about trying to see if I can import Pillar into Squeak.
>       BaselineOfPillar >> customProjectAttributes
>     "Edit to return a collection of any custom attributes e.g. for conditional loading: Array with: #'Condition1' with: #'Condition2.
> For more information see: http://code.google.com/p/metacello/wiki/CustomProjectAttrributes "
> 
> | attributes |
> attributes := OrderedCollection new.
> OSPlatform current isWindows ifTrue: [ attributes add: #windows ].
> OSPlatform current isUnix    ifTrue: [ attributes add: #unix ].
> OSPlatform current isMacOS   ifTrue: [ attributes add: #osx ].
> ^ attributes asArray
> 
> 
> I have poked around a bit and 
>
>       ThisOSProcess concreteClass
> 
> looks like a good replacement candidate.
> 
> However, I figured I would check with you all first.

That's totally unrelated. It's easier to fire up a pharo image if you want 
to figure out what got rewritten into what than guessing.
So, OSPlatform provides the same information as the methods of the os 
category of SmalltalkImage do in Squeak.

A simple replacement of that method in Squeak would be:

^Smalltalk platformName
 	caseOf: {
 		[ 'Mac OS' ] -> [ #(osx) ].
 		[ 'Win32' ] -> [ #(windows) ].
 		[ 'unix' ] -> [ #(unix) ] }
 	otherwise: [ #() ]


Levente

> 
> 
> thx in advance.
> 
> 
> 
> 
> 
> 
>


More information about the Squeak-dev mailing list