Class: Xcodeproj::Project::Object::PBXGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/xcake/xcodeproj_ext/PBXGroup.rb

Instance Method Summary collapse

Instance Method Details

#child_for_path(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/xcake/xcodeproj_ext/PBXGroup.rb', line 7

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

#dirnameObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/xcake/xcodeproj_ext/PBXGroup.rb', line 29

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