• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Detect Linux from the RUBY or Sketchup API

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 5 Posters 878 Views 5 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    fredo6
    last edited by 26 Nov 2014, 14:50

    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

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 26 Nov 2014, 15:06

      The ENV returns some OS specific entries...

      MAC it's TMPDIR
      WIN it's TEMP && USERPROFILE
      LINUX it's USERPROFILE

      So if the user has ENV['USERPROFILE'] BUT NOT TEMP then it's LINUX ?

      TIG

      1 Reply Last reply Reply Quote 0
      • F Offline
        fredo6
        last edited by 26 Nov 2014, 16:28

        TIG,

        Thanks very much.

        By the way don't you have the ! problem on Linux with the PluuginStore (!Sketchucation_loader.rb)?

        Fredo

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 26 Nov 2014, 17:39

          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 !!

          TIG

          1 Reply Last reply Reply Quote 0
          • S Offline
            slbaumgartner
            last edited by 26 Nov 2014, 17:59

            The old standby RUBY_PLATFORM won't work?

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 26 Nov 2014, 18:02

              @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...

              TIG

              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by 26 Nov 2014, 18:07

                TextureResizer.rb by Andreas Eisenbarth uses...

                @platform = RUBY_PLATFORM.include?('darwin')? "mac" ; (RUBY_PLATFORM.include?('mswin')? (!ENV["WINEPREFIX"].nil?? "wine" ; "mswin") ; "other")
                
                

                john

                learn from the mistakes of others, you may not live long enough to make them all yourself...

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tt_su
                  last edited by 27 Nov 2014, 00:05

                  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.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    8/8
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement