XcodeEditor icon indicating copy to clipboard operation
XcodeEditor copied to clipboard

Different groups have same key

Open coduggan opened this issue 12 years ago • 5 comments

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.

coduggan avatar Jun 10 '13 23:06 coduggan

Can I offer you push access?

jasperblues avatar Jun 11 '13 04:06 jasperblues

Sure

coduggan avatar Jun 11 '13 05:06 coduggan

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

jasperblues avatar Jun 11 '13 05:06 jasperblues

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.

s-s-hardin avatar Aug 22 '14 14:08 s-s-hardin

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.

jasperblues avatar Aug 23 '14 01:08 jasperblues