Search code examples
xcode4relative-pathfilepathabsolute-path

How to change the location of a grouped (localization) file from an absolute to a relative path in XCode 4?


I'm having problems with making all file location paths relative in XCode 4.

I have multiple infoPlist.strings and CustomLocalizable.strings (for different languages) grouped together (XCode does this automatically). When looking at the File Inspector (View >> Utilities >> Show File Inspector) for these files (except for the English which is the default language) the Location is 'Absolute Path'.

The problem is that the Location dropdown menu for these files in the File Inspector is grayed out, it's disabled. This keeps me from changing the file location from an absolute path to a relative path description.

What do I need to do to make all path locations of the files in the group relative?

I have already tried to change the path location of the file group to, for instance, 'relative to group' or 'relative to project'. For the group I also set the relative path clicking the small icon blow the location dropdown in the file inspector.

I've been searching to find a solution for a while now and appreciate if anyone could help me answer the above question.

Thank you!


Solution

  • Based on your responses, my own answer in the comments seems to work. So here it is as an official answer:

    1. Choose one of the localized files in the group (e.g. infoPlist.strings, CustomLocalizable.strings): Click on the file in the project tree

    2. In the File Inspector, in the localization pane, remove all languages for which the files have an absolute path, using the '-' button.

    3. Add the languages again, using '+' >> 'Add all' or the specific language. The grouped and localized files will show up again in the tree. In the file inspector you will see that the location changed to 'Relative to group'