diff --git a/lib/xcodeproj/config.rb b/lib/xcodeproj/config.rb index 35d48d39..e022602e 100644 --- a/lib/xcodeproj/config.rb +++ b/lib/xcodeproj/config.rb @@ -341,7 +341,7 @@ def strip_comment(line) # @return [Nil] if no include was found in the line. # def extract_include(line) - regexp = /#include\s*"(.+)"/ + regexp = /#include\??\s*"(.+)"/ match = line.match(regexp) match[1] if match end diff --git a/spec/config_spec.rb b/spec/config_spec.rb index 5cd511ac..f23e3210 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -229,6 +229,12 @@ def filename.open(mode) config.includes.first.should.be.equal 'Somefile.xcconfig' end + it 'contains file path refs to optional included xcconfigs' do + config = Xcodeproj::Config.new(fixture_path('optional-include.xcconfig')) + config.includes.size.should.be.equal 1 + config.includes.first.should.be.equal 'Optional.xcconfig' + end + it 'contains file path refs to all included xcconfigs, even without the extension added' do config = Xcodeproj::Config.new(fixture_path('config-with-include-no-extension.xcconfig')) config.includes.size.should.be.equal 1 diff --git a/spec/fixtures/optional-include.xcconfig b/spec/fixtures/optional-include.xcconfig new file mode 100644 index 00000000..352e589e --- /dev/null +++ b/spec/fixtures/optional-include.xcconfig @@ -0,0 +1 @@ +#include? "Optional.xcconfig"