From f96299978c00066d35fcbc48cb7edc03388f6791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Mon, 18 Aug 2014 13:09:26 +0200 Subject: [PATCH] [Instruments] Ensure we only deal with the templates part of the output. --- lib/motion/project/xcode_config.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index 5cc85dec..281e3b5b 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -301,7 +301,12 @@ EOS if File.exist?(template) template_path = template elsif !builtin_templates.grep(/#{template}/i).empty? - list = `#{locate_binary('instruments')} -s 2>&1`.strip.split("\n").map { |line| line.sub(/^\s*"/, '').sub(/",*$/, '') } + # Get a list of just the templates (ignoring devices) + list = `#{locate_binary('instruments')} -s 2>&1`.strip.split("\n") + start = list.index('Known Templates:') + 1 + list = list[start..-1] + # Only interested in the template (file base) names + list.map! { |line| line.sub(/^\s*"/, '').sub(/",*$/, '') } template = template.downcase template_path = list.find { |path| File.basename(path, File.extname(path)).downcase == template } else