开发者

Xcode 4 Templates—How to add license to beginning of file?

Xcode 4 Templates—How to add license to beginning of file?

I've spent hours trying to figure this out. In my custom Xcode 4 template, I have a checkbox option to include the zlib/libpng license at the top of each source file. Trouble is, no matter what I do I can't make it tack it on to 开发者_如何学Cthe beginning of the file AND keep the rest of the file. It either shows // THIS IS A TEST and nothing else, or the whole file but not the test comment.

I've tried what is shown in the screenshot above and dozens of other things. Help!


Xcode 4 Templates—How to add license to beginning of file?

I figured it out, finally. As you can see in the image above, for every source file I have two rules, :comments and :content. In the Definitions, I set the :content of each to the rest of the file (all in a big string), and in the option i set just the comments of every file depending on whether the checkbox is checked or not. Since the definitions for the files are now strings, not paths, I had to keep the dictionaries for the header files just to keep the <key>TargetIndices</key> <array/> so they don't get added to the Copy Bundle Resources build phase.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜