-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting paths for nested groups #121
Comments
Fabio is probably more familiar with this, but we're both out of time to look into this atm. At the very least I'll say that it should work as you expect. |
Looked into this a bit more, and I'm still not sure why it's not acting as expected, but it seems to be related to the relative path stuff. It's almost as if it's looking at require 'xcodeproj'
def create_new_project
parent_group = @project.new_group('base-group', 'base-group')
create_groups(parent_group, {'foo' => {'bar' => {'baz' => nil}}}, 'base-group')
end
def create_groups(parent_group, group_hash, path_to_group)
group_hash.each_pair do |group_name, children|
new_path = "#{path_to_group}/#{group_name}"
created_group = parent_group.new_group(group_name, new_path)
created_group.path = new_path # We shouldn't need this line. Remove to see the issue.
unless children.nil?
create_groups(created_group, children, new_path)
end
end
end
@project = Xcodeproj::Project.new('foo.xcodeproj')
create_new_project
@project.save |
|
Sorry I missed the point. If the new_path = group_name |
Right, that's what I assumed initially. But if you modify the script above like that, you'll see that the path is then set to |
I should note that it seems like the issue is somewhere inside |
The simplest way to see that behavior is to add |
Kept digging. Everything is cool until this line in |
Can you inspect the values of This logic can create issues with relative file paths, and it is preferable to use absolute paths with Xcodeproj. I don’t have time to check at the moment and I don’t recall the exact details but this gotcha should be noted somewhere in the comments. |
Fixes an issue where if you supplied a relative path when creating a project, all of the relative references from that point on were incorrect. By expanding the path on project creation, we ensure that we're always setting the path the proper way. Fixes #121
The issue ended up being a bug that stemmed from using a relative path to create the project itself. Closing this issue in favor of #124 |
Having trouble groking what's going on here.
I'm trying to create this basic group structure:
The paths for each group should be set relative to the containing group, so that the group structure mimics the structure on disk. For some reason, I can't seem to make this happen. I'm doing something similar to the following:
This works great for the main group, as well as
foo
. But thenbar
gets set tomain_group/bar
andbaz
gets set tomain_group/baz
. What the hell am I missing?The text was updated successfully, but these errors were encountered: