class XcodeProject::FileNode

Constants

SourceTreeMap

Attributes

name[R]
path[R]
source_tree[R]

Public Class Methods

new(root, uuid, data) click to toggle source
Calls superclass method
# File lib/xcodeproject/file_node.rb, line 34
def initialize (root, uuid, data)
        super(root, uuid, data)

        @source_tree = data['sourceTree']
        @name ||= data['name']
        @path ||= data['path']

        @name ||= File.basename(@path) unless @path.nil?
end

Public Instance Methods

group_path() click to toggle source
# File lib/xcodeproject/file_node.rb, line 54
def group_path
        obj = self
        res = ''
        begin
                pn = obj.name ? obj.name : ''
                res = Pathname.new(pn).join(res)
        end while obj = obj.parent;
        res.cleanpath
end
parent() click to toggle source
# File lib/xcodeproject/file_node.rb, line 48
def parent
        root.select_objects do |uuid, data|
                (data['children'].include?(self.uuid) if data['isa'] == 'PBXGroup') ? true : false
        end.first
end
total_path() click to toggle source
# File lib/xcodeproject/file_node.rb, line 64
def total_path
        res = ''
        case source_tree
                when :source_root
                        res = path
                when :group
                        pn = path.nil? ? '' : path
                        res = parent.total_path.join(pn) unless parent.nil?
                else
                        raise ParseError.new("No such '#{source_tree}' source tree type.")
        end
        root.absolute_path(res)
end