sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Using the Registry - Any Gotchas?

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 274 Views 4 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.
    • J Offline
      Jim
      last edited by

      Is there anything to watch for when using the Sketchup.write_default and Sketchup.read_default methods?

      I know it is a pain if you are trying to store Windows paths in the registry, i.e.

      
      C;\Program Files\Google\Google Sketchup 7
      
      

      because the '' character is special in strings.

      Is it a smart strategy to just encode (am i thinking of escape?) everything before it goes in? (and how might I do that?)

      Hi

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        There might be something in this thread, starting with the post I've linked to. Todd tried to explain it to me, but I don't know what hex encoding is.

        301 Moved Permanently

        favicon

        (www.sketchucation.com)

        Maybe a start?

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Could do a test with a set of characters and see if it's stored properly. Maybe the method encodes it before saving...

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • AdamBA Offline
            AdamB
            last edited by

            @jim said:

            Is there anything to watch for when using the Sketchup.write_default and Sketchup.read_default methods?

            I know it is a pain if you are trying to store Windows paths in the registry, i.e.

            
            > C;\Program Files\Google\Google Sketchup 7
            > 
            

            because the '' character is special in strings.

            Is it a smart strategy to just encode (am i thinking of escape?) everything before it goes in? (and how might I do that?)

            Yes, but Ruby 'knows' about unix forward slashes so I tend to always do a:

            a_filepath_string.gsub(/(\)/, '/')

            to everything regardless of platform which then works for PC & Mac.

            Adam

            Developer of LightUp Click for website

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              Thanks Adam, I was actually using the following:

              
               str.gsub!(/\\/, '\\\\')
              
              

              But I think simply changing it to '/' is a better solution, and will modify inputbox.rb I suppose it's possible for someone to want to use \ for some other string, though.

              I'm also escaping double-quotes:

              
              str.gsub!(/"/, '\"')
              
              

              Thanks.

              Hi

              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