views:

157

answers:

1

Hello everybody,

In my Xcode project, I've created a symbolic link script in the target that allows me to edit my scripts and see the updates live. Unfortunately, a side-effect of this is that if I don't clean before building again, I get the following error message:

ln: /Users/atg/Desktop/Projects/Xcode Projects/Debug/Xsera.app/Contents/Resources/: Directory not empty

for the following line in my script:

ln -F -s -f "$PWD/../Resources/" "$BUILD_ROOT/Debug/$UNLOCALIZED_RESOURCES_FOLDER_PATH"

I know that this is the correct line because it works when I build after cleaning, but doesn't work if I build without cleaning.

What I would like to do, therefore, is to figure out how to allow builds without cleaning. I think the easiest way to do this would be to force a clean before I build, but if anybody knows any other way of removing the error, that would be great as well.

Thanks!

A: 

After a little sleuthing over twitter, we came up with the following solution:

if [ ! -d "$BUILD_ROOT/Debug/$UNLOCALIZED_RESOURCES_FOLDER_PATH" ];
then ln -F -s -f "$PWD/../Resources/" "$BUILD_ROOT/Debug/$UNLOCALIZED_RESOURCES_FOLDER_PATH";
fi;

That way, if the directory exists, it doesn't bother with the linking, since it's already established.

adam_0