Mac read_defaults?
-
@dan,
result = Plist;;parse_xml("/Users/johns_iMac/Library/Preferences/com.sketchup.SketchUp.2014.plist") Error; #<ArgumentError; invalid byte sequence in UTF-8> /Users/johns_iMac/Library/Application Support/SketchUp 2014/SketchUp/Gems/gems/plist-3.1.0/lib/plist/parser.rb;91;in `scan'
I don't think its been updated for Ruby 2...
john
-
Well if you search Rubygems.org, you'll see quite a few plist reader gems.
-
@driven said:
@dan,
result = Plist;;parse_xml("/Users/johns_iMac/Library/Preferences/com.sketchup.SketchUp.2014.plist") > Error; #<ArgumentError; invalid byte sequence in UTF-8> > /Users/johns_iMac/Library/Application Support/SketchUp 2014/SketchUp/Gems/gems/plist-3.1.0/lib/plist/parser.rb;91;in `scan'
I don't think its been updated for Ruby 2...
It was supposed to be 1.9.x compatible (since it's v3.0.0)
Try on a simpler plist. Perhaps SketchUp corrupted it's file ?
-
I think it's actually failing on the binary image chunks stored in some of the keys...
the thing is there are many built in plist tools that can be used in any plugin, on any mac...
Gem support from SU Ruby is broken for many things, so I'd favour %x() over failure...
result = %x( plutil -p "/Users/johns_iMac/Library/Preferences/com.sketchup.SketchUp.2014.plist") returns a human readable string...
point is I only want the one item and it should be available from
Sketchup.read_defaults
john -
@driven said:
but every concievable version of
Sketchup.read_default("NSWindow Frame SketchUpDoc", "")
returns nothing...
Sketchup.read_default is not a generic method to read anything from a plist. It's a simple method to read simple values for an extension.
What you try to do I have done using a shell command (backticks I think). (Don't have the sample snippet on my home machine right now.)
-
@driven said:
I think it's actually failing on the binary image chunks stored in some of the keys...
Well it's Doc did say it would choke on data elements.
-
@tt_su said:
...
Sketchup.read_default is not a generic method to read anything from a plist. It's a simple method to read simple values for an extension.I haven't ever suggested it reads random plist's, I think the API should be able to read SketchUp's own plist items...
@unknownuser said:
What you try to do I have done using a shell command (backticks I think).
It will be similar to my first, working example, it works with `` or %x(), I just find %x() more obvious when reading the code...john
-
@driven said:
I think it's actually failing on the binary image chunks stored in some of the keys...
The property you sought looks like this in XCode on my Mac:
It's a string key and value, So I don't think the issue is with binary chunks, it is as TT says simply that read_defaults wasn't designed to read values that weren't written by write_defaults.
Steve
-
@slbaumgartner said:
So I don't think the issue is with binary chunks, ...
@steve...
that comment was referring to the plist gem, it appears to fail on the "BigBrowser" image buttons values that are stored in binary... [but what is BigBrowser??]Now I know it only reads what it can write, I'll continue using
defaults
for anything else...john
-
Well on the PC, we have been in the same boat. The API can read only string registry values. Many things are DWORD binary values. Often holding only 1 or 0 for true/false, on/off, etc. Such a simple thing that can not be read.
A long time ago, I thought I filed a Feature Request for an application level options hash interface.
Advertisement