Sha256: 1d42e82ea19fcf8b2bfccb385da7c83fe8117b09f04246a2156e9744c7412001

Contents?: true

Size: 942 Bytes

Versions: 9

Compression:

Stored size: 942 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}/#{display_name}"
          else
            parent.dirname.to_s
          end
        end
     end
   end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
xcake-0.8.13 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.12 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.10 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.9 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.8 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.7 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.6 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.3 lib/xcake/xcodeproj_ext/PBXGroup.rb
xcake-0.8.1 lib/xcake/xcodeproj_ext/PBXGroup.rb