Determine User Operating System
-
Hey folks,
I've searched around, and I'm sure I missed an easy answer - but how can you determine the operating system of a computer within a ruby script? I really just want to know if whoever is using my plugin is on a Mac or PC - is this possible?
Thanks much, as always!
Derek
-
RUBY_PLATFORM
i386-mswin32
For a Windows system...
See here http://forums.sketchucation.com/viewtopic.php?p=305368#p305368 -
I looked at that for a while as the ideal is to make scripts that work on both.
However as of now I think there are enough differences, and quirks that at some point another choice has to be made:
- Either one doesn't use any problematic known differences and the scripts can be "universal". Very possible with simple scripts with a bit of precautions.
- Or just write a script and there will be a PC and a Mac version, at this point my preferred solution. It's not that big of a deal. If you use a lot of keyboard inputs, boxes, etc.., It's just easier IMO than writing the tests and all the exceptions.
I'm not sure there is an explicit list somewhere of differences but to the best of my knowledge:
- Keyboard input control AND HABITS
- Input box labels (see my other post)
- toolbar management
- file management on Mac cannot have , it must be / (which I think works on both platforms)
- web dialogs not sure if it's all fine
- Some PC plugins guys do stuff with window 32 something (like external control or programming or something), etc..of course no such thing on Mac (Used for ruby console management for example, and some other plugins I've seen it in)
- I'd be very careful about open GL stuff (not encountered yet, so not sure)
- Cursor management also seems to be different (I think I've seen plugins where PC people use cursor and don't report problems, yet on Mac there is just no cursor (it still works, and one wouldn't know until you dig into the rb and see that Oh there was a cursor management for this plugin)
- color and texture selection window.
I may have forgotten a couple. But these are the one I look for systematically in making sure plugins work as intended on Macs (and change accordingly).
And that list is not one direction. Sometimes the Mac is better or friendlier (toolbars), sometimes the other way as far as I can tell. -
I have collected some links to Platform differences in the [ Code Snippets ] index.
Advertisement