Detect Linux from the RUBY or Sketchup API
-
Any way to detect the home system on the computer is on Linux, either from the RUBY API or from the Sketchup API?
The issue I have found is that the ordering of files (so impacting the order of rb files loaded by Sketchup) is different on Linux versus Windows and Mac.
At least the ! sign is not considered coming earlier than the alpha numeric characters.
This is a big issue because I assumed that it would be the case. For instance Fredo6_!LibFredo6.rb should load BEFORE any other Fredo6_xxxx rb files.
Thanks
Fredo
-
The
ENV
returns some OS specific entries...MAC it's
TMPDIR
WIN it'sTEMP
&&USERPROFILE
LINUX it'sUSERPROFILE
So if the user has
ENV['USERPROFILE']
BUT NOTTEMP
then it's LINUX ? -
TIG,
Thanks very much.
By the way don't you have the ! problem on Linux with the PluuginStore (!Sketchucation_loader.rb)?
Fredo
-
The initial ! has never been reported as an issue.
All it would do is load SketchUcation menu later on in the Plugins menu ?
It's just used to load them first, so they are not lost in a long list...
I use # for several of my own plugins as that puts them near the top - not sure how that sorts in Linux either !! -
The old standby RUBY_PLATFORM won't work?
-
@slbaumgartner said:
The old standby RUBY_PLATFORM won't work?
It's likely to mimic Windows setup - I found the ENV way the best trap... -
TextureResizer.rb by Andreas Eisenbarth uses...
@platform = RUBY_PLATFORM.include?('darwin')? "mac" ; (RUBY_PLATFORM.include?('mswin')? (!ENV["WINEPREFIX"].nil?? "wine" ; "mswin") ; "other")
john
-
I would place my bets with Andreas - as he use Linux and probably have figured this out. Looking for a Wine related environment variable makes sense since Wine would make SketchUp think it's running Windows - RUBY_PLATFORM wouldn't say linux.
Advertisement