Sha256: 1c5fa3ffd3e438129a1510e9691d25cf1df7c7461d1301a6f0f3d87566765112

Contents?: true

Size: 987 Bytes

Versions: 10

Compression:

Stored size: 987 Bytes

Contents

require 'xcodeproj'

module Xcodeproj
  class Project
    module Object
      class PBXGroup
        def child_for_path(path)
          unless path.kind_of?(Array)
            path = path.split('/').keep_if do |c|
              c != '.'
            end
          end

          child_name = path.shift
          child = children.find { |c| c.display_name == child_name }

          if child.nil?
            child = new_group(child_name)
            child.path = child_name
          end

          if path.empty?
            child
          else
            child.child_for_path(path)
          end
        end

        def dirname
          return '.' if parent.kind_of? Xcake::Xcode::Project
          return '.' if parent.kind_of? PBXProject
          return parent.dirname.to_s if kind_of? PBXVariantGroup

          if display_name
            "#{parent.dirname}/#{display_name}"
          else
            parent.dirname.to_s
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
xcake-0.13.0 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.12.1 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.12.0 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.11.0 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.10.0 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.9.4 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.9.3 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.9.2 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.9.1 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.9.0 lib/xcake/xcodeproj_ext/PBXGroup.rb