Skip to content

Different groups have same key #24

Open

Description

@coduggan

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.

Activity

  1. jasperblues commented on Jun 11, 2013

    @jasperblues
    Member

    Can I offer you push access?

  2. coduggan commented on Jun 11, 2013

    @coduggan
    Author

    Sure

  3. jasperblues commented on Jun 11, 2013

    @jasperblues
    Member

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

  4. s-s-hardin commented on Aug 22, 2014

    @s-s-hardin

    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.

  5. jasperblues commented on Aug 23, 2014

    @jasperblues
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions