9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/osaka/launchservices.rb', line 9
def self.retrieve(bundle_name)
launch_services_dump = Osaka::CommandRunner.run("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump")
current_hash = {}
launch_services_hash = {}
launch_services_dump.each_line do |line|
if line =~ /^(\w.*):\s+(\w.*)$/
launch_services_hash[current_hash[:name]] = current_hash
current_hash = {:id => $2}
end
if line =~ /^\t(\w.*):\s+(\w.*)$/
current_hash[$1.to_sym] = $2
end
end
launch_services_hash[current_hash[:name]] = current_hash
launch_services_hash[bundle_name]
end
|