我正在尝试创建一个Xcode项目模板,该模板将使用.plist中的以下内容来创建一个包含classe文件的目录:
<key>Definitions</key>
<dict>
<key>Classes</key>
<dict>
<key>Path</key>
<string>Classes</string>
</dict>
</dict>
<key>Nodes</key>
<array>
<string>Classes</string>
</array>
这几乎可行,但Classes中的最后一个文件总是成为Classes文件的引用文件夹,从而创建一个奇怪的递归。
举个例子,假设Classes有3个文件,a.h、b.h和c.h。生成的项目将具有如下的文件结构:
project
+-Classes
+-a.h
+-b.h
+-c.h //This is not a proper .h file, it is a file reference
+-a.h
+-b.h
+-c.h //This is the actual .h file
有没有一种干净的方法可以让项目模板从一个目录中复制所有文件?
经过大量研究,这似乎是Xcode模板系统的一个错误。似乎没有一种方法可以在不产生这个问题的情况下复制包含其他文件的目录(至少在编写这个答案时)。
我能找到的唯一替代方案是在项目模板的目录中手动指定每个文件,指定文件的组以匹配文件夹结构。
<key>Definitions</key>
<dict>
<key>Classes/a.h</key>
<dict>
<key>Group</key>
<array>
<string>Classes</string>
</array>
<key>Path</key>
<string>Classes/a.h</string>
</dict>
<!--Repeat for b and c-->
</dict>
<key>Nodes</key>
<array>
<string>Classes/a.h</string>
<!--Repeat for b and c-->
</array>