Skip to content
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

Different groups have same key #24

Open
coduggan opened this issue Jun 10, 2013 · 5 comments
Open

Different groups have same key #24

coduggan opened this issue Jun 10, 2013 · 5 comments

Comments

@coduggan
Copy link

Say I add a group with path named @"Phone" to the root group. Then in that group, I add a group with path named @"@2x".

Then if I add a group to the root group called @"Pad", and in that group I add a group called @"@2x", it will have the same key as the first @"@2x" group, even though it is a different group.

In XCGroup's addGroupWithPath: method, you are generating the key just based on the passed in variable path, which is not the full path of the group, but the last path component, which could be the same as the last path component of other groups.

@jasperblues
Copy link
Member

Can I offer you push access?

@coduggan
Copy link
Author

Sure

@jasperblues
Copy link
Member

Granted - thanks very much. . I've also added you as a contributor on the Readme - feel free to edit.

@s-s-hardin
Copy link

This is also an issue when you have two targets in a project that each need their own copy of a file. In this scenario the File Reference Key and Build File Reference Key of both files will be identical (due to hashing the path of the file relative to its parent group instead of the project's root). Both files will show up in Xcode's Project Navigator without any issue despite sharing a File Reference Record (since the path of the file is resolved relative to its parent group) but they cannot be independently added to to their own target.

@jasperblues
Copy link
Member

It badly needs fixing. A quick fix, would be to add a time-component to the name-hashing that it used in:

https://github.com/jasperblues/XcodeEditor/blob/master/Source/Main/Utils/XCKeyBuilder.m

. . The method could also be marked synchronized, and have a small artificial delay (~1ms), to ensure a unique hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants