class XcodeProject::PBXFileReference

Constants

FileTypeMap

Public Class Methods

add(root, path) click to toggle source
# File lib/xcodeproject/pbx_file_reference.rb, line 43
def self.add(root, path)
        uuid, data = root.add_object(self.create_object_hash(path)) 
        self.new(root, uuid, data)
end
new(root, uuid, data) click to toggle source
Calls superclass method XcodeProject::FileNode::new
# File lib/xcodeproject/pbx_file_reference.rb, line 30
def initialize (root, uuid, data)
        super(root, uuid, data)
end

Private Class Methods

create_object_hash(path) click to toggle source
# File lib/xcodeproject/pbx_file_reference.rb, line 50
def self.create_object_hash (path)
        path = path.to_s
        name = File.basename(path)
        ext = File.extname(path)
        raise ParseError.new("No such file type '#{name}'.") if !FileTypeMap.include?(ext)
        
        data = []
        data << ['isa', 'PBXFileReference']
        data << ['sourceTree', '<group>']
        # data << ['fileEncoding', '4'] # utf-8
        data << ['lastKnownFileType', FileTypeMap[ext]]
        data << ['path', path]
        data << ['name', name] if name != path

        Hash[ data ]
end

Public Instance Methods

remove!() click to toggle source
# File lib/xcodeproject/pbx_file_reference.rb, line 34
def remove!
        root.build_files(uuid).each do |build_file_obj|
                build_file_obj.remove!
        end
        
        parent.remove_child_uuid(uuid)
        root.remove_object(uuid)
end