Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch replace copyright comment in XCode

Tags:

xcode

ios

I've been working on an iOS project for some time now, creating hundreds of source files, and now that's it's good and done, I realize something sad : I edit the copyright file template before getting to work, and all of my files have this lame format :

//
//  MyClass.h
//
//  Created by Redwarp on 3/25/13.
//  Copyright (c) 2013 Redwarp. All rights reserved.
//

And that's not cool ! I would like to replace it with something more like that :

/* This software is licensed under the Apache 2 license, quoted below.

Copyright 2013 Redwarp <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/

Anyway. I could probably write a script, that searches all my files and replace the first "//" lines with a better comment, but I'm sure there is a tool out there that does that perfectly.

Except : I can't find that tool anywhere.

Would anyone know of such a tool ? (Or might it be that I'm a fool ?)

like image 941
Redwarp Avatar asked Mar 25 '13 18:03

Redwarp


People also ask

How do I change the copyright code in Xcode?

You can change the copyright template in Xcode here: Project Navigator -> File Inspector -> "Organization". Save this answer.

How to change author name in Xcode?

Go to Users & Groups (in the System row); your user account should already be selected. Click on the "Open..." button for the Address Book Card. Changing your name in the Address Book won't change any already-created files; it will only affect new files that you create. In Xcode 4, open up your project.

How to search entire Xcode project?

To find text in a file, open the file in the Xcode source editor and choose Find > Find from the menu bar. Xcode displays the Find bar and its search controls at the top of the file. Enter a search term. Xcode searches the file, highlights matches, and notes how many it finds.


1 Answers

I ended up using the script I found here : http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/

Does exactly the job I wanted to do, and spared me the burden of doing it myself.

like image 140
Redwarp Avatar answered Oct 07 '22 00:10

Redwarp