sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    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.
    • fredo6F Offline
      fredo6
      last edited by

      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
      • TIGT Offline
        TIG Moderator
        last edited by

        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
        • fredo6F Offline
          fredo6
          last edited by

          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
          • TIGT Offline
            TIG Moderator
            last edited by

            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

              The old standby RUBY_PLATFORM won't work?

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                @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

                  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
                  • tt_suT Offline
                    tt_su
                    last edited by

                    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
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement