To manage the diversity of the operating systems and hosts a Cuis-Smalltalk application is running on, the Strategy pattern is handy.
In DrGeo, it is implemented with a hierarchy of DrGPlatform, each one with its own strategy to access resources and preferences in the host: DrGWorkstation to operate on personal computers, DrGDevelopment to operate in developer mode, DrGAndroid and DrGiPad on tablets. The two latter ones are no longer implemented as DrGeo is not ported to these devices anymore.
Then, in the DrGeoSystem class, it is decided which kind of platform to use, depending on how the system is configured:
DrGeoSystem>>beWorkstation
platform := DrGWorkstation new
Or
DrGeoSystem>>beDevelopment
"Be like the Cuis environment for DrGeo development" platform := DrGDevelopment new
The resources are accessed from the DrGeoSystem public class protocol without knowing which platform is used underneath:
DrGeoSystem class>>iconsPath
^ platform iconsPath
It depends on the selected platform, which is only known by DrGeoSystem:
DrGPlatform>>iconsPath
^ self resourcesPath / 'icons'
DrGWorkstation>>iconsPath
^ self resourcesPath / 'graphics' / 'iconsSVG'