lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.163.pre4 vs lib/calabash-cucumber/launch/simulator_helper.rb in calabash-cucumber-0.9.163.pre5
- old
+ new
@@ -243,11 +243,24 @@
Dir[File.join(bundle_path,'*.app')].first if bundle_path
end
def self.linked_with_calabash?(d)
- out = `otool "#{File.expand_path(d)}"/* -o 2> /dev/null | grep CalabashServer`
- /CalabashServer/.match(out)
+ skipped_formats = [".png", ".jpg", ".jpeg", ".plist", ".nib", ".lproj"]
+ dir = File.expand_path(d)
+
+ # For every file on that .app directory
+ Dir.entries(d).each do |file|
+ # If this is an asset or any of those skipped formats, skip it.
+ next if skipped_formats.include? File.extname(file)
+
+ # If its not, try to run otool against that file, check whether we are linked against calabash framework.
+ out = `otool #{dir}/#{file} -o 2> /dev/null | grep CalabashServer`
+ return true if /CalabashServer/.match(out)
+ end
+
+ # Defaulted to false
+ false
end
def self.find_preferred_dir(sim_dirs)
sim_dirs.find do |d|
linked_with_calabash?(d)