Xcode: provide correct file name in header comments?

Is there a quick fix / check so that the file names in the header comments actually match the file name?

I just made huge refactoring / convention changes and found that some of them I forgot to update the header comments for some files.

I know this other question about header comments . But I do not want to change the templates. I like the Xcode template giving me as it is. I just want to make sure it matches.


Example

//
//  XXShim.h
//  ProjectX
//
//  Created by Me Myself on 3/15/12.
//  Copyright (c) 2012 My Company Ltd. All rights reserved.
//

#import <CoreData/CoreData.h>

@interface YYProxy : NSObject

Look, itโ€™s XXShimnow YYProxyin the file now called YYProxy.h, but the header comment is still not right.

+3
source share
1 answer

, , , .

find . -iname "*.[mh]" -exec sed -n "2s|^//  ||p" "{}" \; -exec basename "{}" \; | uniq -u

cd . , , .

EDIT: script (, ) :

find . -iname '*.[mh]' -print0 | while IFS= read -r -d '' file; do basename=`basename "$file"`; sed -i '' "2s|//  .*\$|//  $basename|" "$file"; done
0

All Articles