Extract bundle_path method from Xcode#prefix

This commit is contained in:
Jack Nagel 2013-07-21 16:41:51 -05:00
parent 3807bd220a
commit 9f2f5c81e9

View File

@ -51,11 +51,7 @@ module MacOS::Xcode extend self
# fallback for broken Xcode 4.3 installs # fallback for broken Xcode 4.3 installs
Pathname.new("#{V4_BUNDLE_PATH}/Contents/Developer") Pathname.new("#{V4_BUNDLE_PATH}/Contents/Developer")
else else
# Ask Spotlight where Xcode is. If the user didn't install the path = bundle_path
# helper tools and installed Xcode in a non-conventional place, this
# is our only option. See: http://superuser.com/questions/390757
path = MacOS.app_with_bundle_id(V4_BUNDLE_ID) ||
MacOS.app_with_bundle_id(V3_BUNDLE_ID)
unless path.nil? unless path.nil?
path += "Contents/Developer" path += "Contents/Developer"
@ -65,6 +61,13 @@ module MacOS::Xcode extend self
end end
end end
# Ask Spotlight where Xcode is. If the user didn't install the
# helper tools and installed Xcode in a non-conventional place, this
# is our only option. See: http://superuser.com/questions/390757
def bundle_path
MacOS.app_with_bundle_id(V4_BUNDLE_ID) || MacOS.app_with_bundle_id(V3_BUNDLE_ID)
end
def installed? def installed?
not prefix.nil? not prefix.nil?
end end