-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #661 from k3zi/group-reference-fix
[#657] Form path for group references taking into account parent group.
- Loading branch information
Showing
16 changed files
with
699 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module Xcodeproj | ||
class Workspace | ||
# Describes a file/group reference of a Workspace. | ||
# | ||
class Reference | ||
# @return [String] the type of reference to the project | ||
# | ||
# This can be of the following values: | ||
# - absolute | ||
# - group | ||
# - container | ||
# - developer (unsupported) | ||
# | ||
attr_reader :type | ||
|
||
# Returns the relative path to the parent group reference (if one exists) | ||
# prepended to the passed in path. | ||
# | ||
# @param [REXML::Element] xml_node | ||
# the XML representation. | ||
# | ||
# @param [String] path | ||
# the path that will be prepended to. | ||
# | ||
# @return [String] the extended path including the parent node's path. | ||
# | ||
def self.prepend_parent_path(xml_node, path) | ||
if !xml_node.parent.nil? && (xml_node.parent.name == 'Group') | ||
group = GroupReference.from_node(xml_node.parent) | ||
if !group.location.nil? && !group.location.empty? | ||
path = '' if path.nil? | ||
path = File.join(group.location, path) | ||
end | ||
end | ||
|
||
path | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.