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

    [Bug] Sketchup.write_default on Mac

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 207 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.
    • T Offline
      tomasz
      last edited by

      I have a problem with storing UTF-8 string into "default settings" on Mac.

      ` Sketchup.read_default("MySettings","MyKey")

      nil
      Sketchup.write_default("MySettings","MyKey","Test")
      true
      Sketchup.read_default("MySettings","MyKey")
      Test
      Sketchup.write_default("MySettings","MyKey","Błąd")
      true!
      Sketchup.read_default("MySettings","MyKey")
      nil!!`

      Is there any encoding that would let me store the UTF8 string into the default settings on Mac?
      Where can I locate the ini file SketchUp stores the data?

      Thanks
      Tomasz

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • jeff hammondJ Offline
        jeff hammond
        last edited by

        @tomasz said:

        Where can I locate the ini file SketchUp stores the data?

        Thanks
        Tomasz

        (non developer response below.. proceed with care 😉 )

        i think you're looking for the .plist file on mac instead.. in which case, it's at

        user/ Library/ Preferences/ com.google.sketchuppro8.plist (or whatever SU version)..

        note*-- user library is hidden on new mac OSes..

        dotdotdot

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

          As Jeff says, on a Mac its stored as some XML (with a .plist extension)

          Why don't you just escape it:

          Save it as Sketchup.write_default("MySettings","MyKey", "Błąd".unpack('H')[0])*

          Load it as Sketchup.read_default("MySettings","MyKey").to_a.pack('H')*

          Tadaa!

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • T Offline
            tomasz
            last edited by

            @unknownuser said:

            i think you're looking for the .plist file on mac instead.. in which case, it's at
            user/ Library/ Preferences/ com.google.sketchuppro8.plist (or whatever SU version)

            Thanks. Have fount it. Everything is written fine there!
            It is the read method that doesn't convert it back to UTF8, I guess.

            Btw. I have found MainFrame_M2Upgrade Boolean entry 😄 (switched off)

            @adamb said:

            Why don't you just escape it:
            Save it as Sketchup.write_default("MySettings","MyKey", "Błąd".unpack('H')[0])*

            Load it as Sketchup.read_default("MySettings","MyKey").to_a.pack('H')*

            Tadaa!

            Thanks. You are right.
            I was thinking of reading the file from C++, but it is too much to find the right one. Old Ruby way will work better.

            I will report the bug.

            Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

              Yea, the attributes seem to be picky about what you can store, without giving much hints to what is accepted - nor tell you when something fails.
              To store data, non-text, I've been using Base64.

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

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                Keep in mind that read_default passes the attribute text through eval() before it is returned, apparently with a rescue nil clause (or modifier.)

                This is why we cannot have any un-escaped embedded double-quote characters in the attribute.

                I'm not here much anymore.

                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