class Xcodeproj::Project::Object::PBXFileReference


This class represents a reference to a file in the file system.

def build_files

Returns:
  • (Array) - the build files associated with the
def build_files
  referrers.grep(PBXBuildFile)
end

def display_name

Returns:
  • (String) - the name of the file taking into account the path if
def display_name
  name || (File.basename(path) if path)
end

def file_reference_proxies

Returns:
  • (Array) - The file reference proxies for
def file_reference_proxies
  containers = proxy_containers
  if containers.empty?
    []
  else
    project.objects.select do |object|
      object.isa == 'PBXReferenceProxy' &&
        containers.include?(object.remote_ref)
    end
  end
end

def hierarchy_path

Returns:
  • (String) - A representation of the reference hierarchy.
def hierarchy_path
  GroupableHelper.hierarchy_path(self)
end

def move(new_parent)

Returns:
  • (void) -

Parameters:
  • new_parent (PBXGroup) --
def move(new_parent)
  GroupableHelper.move(self, new_parent)
end

def parent

Returns:
  • (PBXGroup, PBXProject) - the parent of the file.
def parent
  GroupableHelper.parent(self)
end

def parents

Returns:
  • (Array) - The list of the parents of the
def parents
  GroupableHelper.parents(self)
end

def project_reference_metadata

Returns:
  • (ObjectDictionary, nil) - The external project metadata for
def project_reference_metadata
  project.root_object.project_references.find do |project_reference|
    project_reference[:project_ref] == self
  end
end

def proxy?

Returns:
  • (Bool) - always false for this ISA.
def proxy?
  false
end

def proxy_containers

Returns:
  • (Array) - The containers for items in
def proxy_containers
  project.objects.select do |object|
    object.isa == 'PBXContainerItemProxy' &&
      object.container_portal == uuid
  end
end

def real_path

Returns:
  • (Pathname) - the absolute path of the file resolving the
def real_path
  GroupableHelper.real_path(self)
end

def remove_from_project

Returns:
  • (void) -

Other tags:
    See: AbstractObject#remove_from_project -
def remove_from_project
  if project_reference = project_reference_metadata
    file_reference_proxies.each(&:remove_from_project)
    target_dependency_proxies.each(&:remove_from_project)
    project_reference[:product_group].remove_from_project
    project.root_object.project_references.delete(project_reference)
  end
  super
end

def set_explicit_file_type(type = nil)

Returns:
  • (void) -
def set_explicit_file_type(type = nil)
  self.last_known_file_type = nil
  if type
    self.explicit_file_type = type
  elsif path
    extension = Pathname(path).extname[1..-1]
    self.explicit_file_type = Constants::FILE_TYPES_BY_EXTENSION[extension]
  end
end

def set_last_known_file_type(type = nil)

Returns:
  • (void) -
def set_last_known_file_type(type = nil)
  if type
    self.last_known_file_type = type
  elsif path
    extension = Pathname(path).extname[1..-1]
    self.last_known_file_type = Constants::FILE_TYPES_BY_EXTENSION[extension]
  end
end

def set_path(path)

Returns:
  • (void) -

Parameters:
  • the (#to_s) -- path for the reference.
def set_path(path)
  if path
    GroupableHelper.set_path_with_source_tree(self, path, source_tree)
  else
    self.path = nil
  end
end

def set_source_tree(source_tree)

Returns:
  • (void) -

Parameters:
  • source_tree (Symbol, String) --
def set_source_tree(source_tree)
  GroupableHelper.set_source_tree(self, source_tree)
end

def target_dependency_proxies

Returns:
  • (Array) - The dependencies on targets
def target_dependency_proxies
  containers = proxy_containers
  if containers.empty?
    []
  else
    project.objects.select do |object|
      object.isa == 'PBXTargetDependency' &&
        containers.include?(object.target_proxy)
    end
  end
end