Xcode - build phase or script for copying only mod

2019-05-30 18:09发布

Mac OS X 10.5 compatibility required. Xcode 3.2.5.

My app looks in the bundle's Resources folder, for a "data" folder.

"data" contains a hierarchy of subfolders and data. The contents are constantly being modified.

I don't need to navigate or modify this data within Xcode.

Q. When building, how can I copy "data" (say, from the Xcode project's folder) to the Resources folder, but only copying those files within "data" that have been modified since the last build?

(Simply copying all files every time I build is not feasible; the file sizes are too large, slowing build times.)

Thanks for any help.

1条回答
姐就是有狂的资本
2楼-- · 2019-05-30 18:42

Shouldn't be a problem to use rsync in a shell script build phase. Something like this:

rsync -a "${SRCROOT}/data" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"

That does a bit more than date comparison but it should still be quite a bit faster than what you're doing now.

The above doesn't delete any files you removed from the source directory; to do so, you can add --delete but I'd only suggest doing that after you're sure it's working properly.

查看更多
登录 后发表回答