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

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -