lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.80.pre.5 vs lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.80
- old
+ new
@@ -27,17 +27,20 @@
end
def self.derived_data_dir_for_project
dir = project_dir
-
+ xcode_workspace_name = ''
info_plist = Dir.glob(DEFAULT_DERIVED_DATA_INFO).find { |plist_file|
begin
plist = CFPropertyList::List.new(:file => plist_file)
hash = CFPropertyList.native_types(plist.value)
ws_dir = File.dirname(hash['WorkspacePath']).downcase
p_dir = dir.downcase
+ if (p_dir.include? ws_dir)
+ xcode_workspace_name = ws_dir.split('/').last
+ end
ws_dir == p_dir
rescue
false
end
}
@@ -58,9 +61,16 @@
build_dirs = Dir.glob("#{DERIVED_DATA}/*").find_all do |xc_proj|
File.basename(xc_proj).start_with?(xcode_proj_name)
end
+ if (build_dirs.count == 0 && !xcode_workspace_name.empty?)
+ # check for directory named "workspace-{deriveddirectoryrandomcharacters}"
+ build_dirs = Dir.glob("#{DERIVED_DATA}/*").find_all do |xc_proj|
+ File.basename(xc_proj).downcase.start_with?(xcode_workspace_name)
+ end
+ end
+
if (build_dirs.count == 0)
msg = ["Unable to find your built app."]
msg << "This means that Calabash can't automatically launch iOS simulator."
msg << "Searched in Xcode 4.x default: #{DEFAULT_DERIVED_DATA_INFO}"
msg << ""