开发者

Is it possible to force an Xcode project to clean before it builds?

开发者 https://www.devze.com 2022-12-21 00:57 出处:网络
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 befor

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消