批量替换XCode中的版权注释

时间:2013-03-25 18:35:10

标签: ios xcode

我已经在iOS项目上工作了一段时间,创建了数百个源文件,现在它已经很好并且已经完成了,我意识到一些令人伤心的事情:我在开始工作之前编辑版权文件模板,并且我的文件有这种蹩脚的格式:

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

那并不酷!我想用更像这样的东西替换它:

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

Copyright 2013 Redwarp <redwarp@gmail.com>
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.
*/

反正。我可以编写一个脚本,搜索我的所有文件并用更好的注释替换第一行“//”行,但我确信有一个工具可以完美地完成。

除了:我无法在任何地方找到该工具。

有人知道这样的工具吗? (或者可能是我是个傻瓜?)

1 个答案:

答案 0 :(得分:4)

我最终使用了我在这里找到的脚本:http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/

完全是我想做的工作,并且免除了我自己做的负担。