Recently I had to automate a few very VERY redundant tasks on Mac. We have been using PowerGlot - an application used to localize nib and string resources. The following were the steps which are used to localize any application:
- Choose the English Resource Folder (which contains nib and string resources)
- Choose the Target Resource Folder (where the localized files would be placed)
- Give the glossary which has the translations stored in it.
I checked out the source code from the CVS repository on my system, and ran the script which finished off the work in a few minutes.
Little did I realize that when the script was placing the nibs in the target folders it overwrote any previous CVS entries inside the nib.
A nib is basically a Bundle which CVS treats as a simple directory, so when you check in a nib into the repository, CVS will insert its entries inside the nib bundle.
I read many forums to figure out a way to open the bundle using applescript but without any luck. Then on one of the forums I read someone who had faced a similar problem and tar might help.
A few more searches on how to use TAR and sure enough it be my saviour! Just posting the code snippet here for future reference:
-- tempPath had the localized resources -- targetPath was the folder inside the CVS repository do shell script "(cd "" & tempPath & ""; tar cf - * --exclude CVS) | (cd "" & targetPath & ""; tar xfp -)"
"--exclude CVS" option ensures that if any CVS folder exists inside the localized nib data it doesn't get copied into the new target folder (which in my case was the actual repository)