jueves, 2 de junio de 2016

Detecting system platform in Smalltalk

This is a short post describing how to detect the system platform (Operating System) where your virtual-machine is running. You can use the following expressions in several major Smalltalk flavors:

Pharo

" Pharo >= 4 "
Smalltalk os isWin32.
Smalltalk os isMacOS.
Smalltalk os isMacOSX.
Smalltalk os isUnix.
" Pharo 3 "
OSPlatform current isWindows.
" Pharo 2 "
OSPlatform isWin32.

VisualWorks >= 7

ExternalInterface currentPlatform.

Dolphin 7

OSVERSIONINFO current osName.
OSVERSIONINFO current isWinV5OrLater
OSVERSIONINFO current isWinV6OrLater
OSVERSIONINFO current isWinVista
OSVERSIONINFO current isWinXP
OSVERSIONINFO current isWinXPOrLater
OSVERSIONINFO current isNT