[squeak-dev] Squeak equivalent of OSPlatform ?

Marcel Taeumel marcel.taeumel at hpi.de
Tue Oct 20 14:31:08 UTC 2020


Hi Timothy.

Both OSProcess and also Squeak-FFI interface SmalltalkImage (via "Smalltalk" global), which queries platform-specific attributes (or labels) via VM primitives:

OSProcess class >> #platformName
OSProcess class >> #platformSubtype
OSProcess class >> #osVersion

FFIPlatformDescription class >> #current 
FFIPlatformDescription >> #name
FFIPlatformDescription >> #subtype

FFIPlatformDescription >> #is(Windows|ARM|Unix)


SmalltalkImage >> #getSystemAttribute:
SmalltalkImage >> #platformName
SmalltalkImage >> #platformSubtype


But beware of writing too much "is(Unix|Windows)"-like code across your abstraction levels because checking for more specific capabilites might produce more readable code such as "canReadFat32Device". ... which was not your question at all here. :-D

Best,
Marcel
Am 20.10.2020 14:37:50 schrieb gettimothy via Squeak-dev <squeak-dev at lists.squeakfoundation.org>:
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 [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.



thx in advance.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201020/1bbdd36e/attachment.html>


More information about the Squeak-dev mailing list