Sha256: a01a541795f4bbb180c2b56d37686bbde7574888ec9bec485c835d93c1e166d1

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

require 'Xcodeproj'

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

          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.is_a? Xcake::Xcode::Project
          return "." if parent.is_a? PBXProject
          return parent.dirname.to_s if is_a? PBXVariantGroup

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xcake-0.7.1 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.7.0 lib/xcake/xcodeproj_ext/PBXGroup.rb