MacRuby: How to read a plist file? -
MacRuby: How to read a plist file? -
i bet super simple , easy can't find basic illustration online. how can read info plist file in project using macruby?
solution:turns out there's few different ways it, cleanest i've found (so far) utilize macruby helper method load_plist (which turns plist file's contents hash). also, if you're using xcode, need file path relative app bundle:
# there's appconfig.plist file in app bundle config_path = nsbundle.mainbundle.pathforresource('appconfig', oftype: 'plist') @config = load_plist file.read(config_path)
this slide deck macruby has illustration code accessing plist files (slides 77-80), gist of open file nsdictionary.dictionarywithcontentsoffile , manipulate ruby hash, write 1 time again writetofile_atomically. nsdictionary documentation might useful you; can find here.
plist macruby
Comments
Post a Comment