Re: Copy Build Phase should keep modification Date
Re: Copy Build Phase should keep modification Date
- Subject: Re: Copy Build Phase should keep modification Date
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Fri, 28 Apr 2017 15:49:45 +0700
>> Xcode Version 8.3.2 (8E2002).
>>
>> I have a Copy Build Phase which copies some files.
>>
>> It seems that Xcode checks whether these files are newer, and if so, copies
>> them to the app bundle. So far so good.
>>
>> But while copying, it changes the modification date to the time of the build.
>> I rather would like to keep the modification dates (similar to cp -p).
>>
>> Is this possible? If so, how?
>
> I don't know offhand whether it's possible within Xcode's pre-configured copy
> files build phase, but whenever I encounter such limits in Xcode's built-ins I
> will quite happily make my own run script build phase. In this case, I know I
> have some projects that run an rsync command to copy (new/updated) files and
> preserve the file attributes. Other similar commands exist, I just use rsync
> because I am familiar with it.
Ok. I made a Run Script (running before Copy Bundle Resources). Seems to work ok.
#!/bin/sh
SOURCE_FOLDER=...
DESTINATION_FOLDER="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
for COMPLETE_NAME in “Some file.extention” “Other File.txt” # BAD: should be content of “Group of Files”
do
SOURCE_FILE="${SOURCE_FOLDER}/${COMPLETE_NAME}"
DESTIN_FILE="${DESTINATION_FOLDER}/${COMPLETE_NAME}"
if [ -f "$SOURCE_FILE" ] ; then
if [ "$SOURCE_FILE" -nt "$DESTIN_FILE" ]; then
cp -pv "${SOURCE_FILE}" "${DESTINATION_FOLDER}"
else
echo "not newer → ignore: $COMPLETE_NAME"
fi
else
echo "Error: no such file: $SOURCE_FILE"
fi
done
But: In Xcode’s Project navigator I have a group (not a folder reference) which contains several files; let’s call it “Group of Files”.
How can I access the content of “Group of Files” in my Run Script ? Currently I have the names hardcoded, which is not very nice - especially if I add other files to “Group of Files” later on.
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden