David T. Lewis
lewis at mail.msen.com
Fri Dec 23 22:43:56 UTC 2005
On Fri, Dec 23, 2005 at 01:40:09PM -0800, tim Rowledge wrote:
> On 23-Dec-05, at 1:34 PM, Cowdery, Bob [UK] wrote:
> > I am sure this must be obvious but I cant find it. How do I
> > determine programmatically which OS I am running on.
> Oh, easy.
> If it keeps crashing then it must be windows.
> If it rarely crashes but the GUI is horrible it must be *nix
> If it rarely crashes and the UI is ok but insists on a single button
> mouse it must OSX
> If it rarely crashes - but when it does it really pisses you off -
> and the GUI is ok with a three button mouse but the machine seems a
> bit slow by modern standards then it must be RISC OS.
Tim's heuristics are of course correct, but unfortunately nobody has
gotten around to implementing the requisite methods for #hasHorribleUserInterface,
#hasRecentlyCrashedForNoGoodReason, and #hasRestictiveMousePolicy. These
will require some new primitives and platform support code in VMMaker,
which of course would be trivial to implement, but I guess somehow this
just has not bubbled up to the top of the priority list. Tim, I think
you should get the development under way, and schedule it for release
next April 1. Come to think of it, an annual april fools' day release
of VMMaker with lots of fun new features would be a good tradition to
> Or you can be really boring and use
> SmalltalkImage current platformName
> and look at other methods in SmalltalkImage for further messages to
> get more or less detail.
There are some examples of how to use this in OSProcess (from SqueakMap).
See class OSProcess, class side methods in "platform identification".
The various flavors of Mac can be confusing if you need to sort out the
difference between pre and post OSX, or if you need to know whether
your user is running a regular Mac VM or a Unix VM on OSX.
More information about the Squeak-dev