diff --git a/lib/xcodeproj/project/object/helpers/groupable_helper.rb b/lib/xcodeproj/project/object/helpers/groupable_helper.rb index 1ae19fb43..73637fcf4 100644 --- a/lib/xcodeproj/project/object/helpers/groupable_helper.rb +++ b/lib/xcodeproj/project/object/helpers/groupable_helper.rb @@ -153,7 +153,7 @@ def source_tree_real_path(object) real_path(object_parent) end when 'SOURCE_ROOT' - object.project.project_dir + object.project.project_dir + object.project.root_object.project_dir_path when '' nil else diff --git a/spec/project/object/helpers/groupable_helper_spec.rb b/spec/project/object/helpers/groupable_helper_spec.rb index 9e2b9c707..ebbf89818 100644 --- a/spec/project/object/helpers/groupable_helper_spec.rb +++ b/spec/project/object/helpers/groupable_helper_spec.rb @@ -183,13 +183,20 @@ module ProjectSpecs @helper.source_tree_real_path(@group).should == Pathname.new('/project_dir') end - it 'check project_dir_path adjustment' do + it 'check project_dir_path adjustment relative to main group' do @group.source_tree = '' @project.root_object.stubs(:project_dir_path).returns('../') @helper.source_tree_real_path(@group).to_s.should.not.include Pathname.new('/project_dir').to_s Pathname.new('/project_dir').to_s.should.include @helper.source_tree_real_path(@group).to_s end + it 'check project_dir_path adjustment relative to project root' do + @group.source_tree = 'SOURCE_ROOT' + @project.root_object.stubs(:project_dir_path).returns('../') + @helper.source_tree_real_path(@group).to_s.should.not.include Pathname.new('/project_dir').to_s + Pathname.new('/project_dir').to_s.should.include @helper.source_tree_real_path(@group).to_s + end + it 'returns the source tree of a path relative to a group' do @group.source_tree = '' @group.path = '/parent_group_path'