module Util
misc utils
Public Instance Methods
bundle_id(app)
click to toggle source
# File lib/bunch/url_generator.rb, line 16 def bundle_id(app) shortname = app.sub(/\.app$/, '') apps = `mdfind -onlyin /Applications -onlyin /Applications/Setapp -onlyin /Applications/Utilities -onlyin ~/Applications -onlyin /Developer/Applications -onlyin /System/Applications 'kMDItemKind==Application'` return false if !apps || apps.strip.length == 0 foundapps = apps.split(/\n/).select! { |line| line.chomp =~ /#{shortname}\.app$/i } if foundapps.length > 0 foundapp = foundapps[0] else return false end if foundapp bid = `mdls -name kMDItemCFBundleIdentifier -r "#{foundapp}"`.chomp else # warn "Could not locate bundle id for #{shortname}, using provided app name" bid = app end bid end