Skip to content

Instantly share code, notes, and snippets.

@kechol
Created August 24, 2013 07:48
Show Gist options
  • Select an option

  • Save kechol/6326720 to your computer and use it in GitHub Desktop.

Select an option

Save kechol/6326720 to your computer and use it in GitHub Desktop.
parse URL Scheme from plists.
# coding: utf-8
require "rubygems"
require "plist"
PLIST_DIR = "./file/"
result = {}
Dir.foreach(PLIST_DIR) do |file|
path = PLIST_DIR + file
next unless File::file?(path)
puts path
xml = Plist::parse_xml(path)
apps = xml['applicationDictionaries']
apps.each do |app|
appname = app['CFBundleName']
puts appname
if(app['CFBundleURLTypes'] && app['CFBundleURLTypes'].count > 0)
result[appname] = app['CFBundleURLTypes'][0]['CFBundleURLSchemes']
else
result[appname] = []
end
end
end
puts result.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment