lib/xcpretty/reporters/json_compilation_database.rb in xcpretty-0.2.1 vs lib/xcpretty/reporters/json_compilation_database.rb in xcpretty-0.2.2
- old
+ new
@@ -37,10 +37,13 @@
end
def format_compile_command(compiler_command, file_path)
directory = file_path.gsub("#{@current_path}", '').gsub(/\/$/, '')
directory = '/' if directory.empty?
- cmd = compiler_command.gsub(/(\-include)\s.*\.pch/, "\\1 #{@pch_path}")
+
+ cmd = compiler_command
+ cmd = cmd.gsub(/(\-include)\s.*\.pch/, "\\1 #{@pch_path}") if @pch_path
+
@compilation_units << {command: cmd,
file: @current_path,
directory: directory}
end