当我想创建一个新文件时,如何更改Xcode模板文件?我在网上搜索了一下,但Xcode11的更改路径不正确
我尝试了这些:
~/Library/Developer/Xcode/Templates
~/Library/Developer/Xcode/Templates/File Templates/Source
~/Library/Application Support/Developer/Shared/Xcode/File Templates/但找不到模板文件。
发布于 2020-03-20 06:13:14
Apple的文件模板包含在Xcode应用程序包中。
Xcode/Contents/Developer/Library/Xcode/Templates/File Templates您不应该修改Xcode应用程序包中的文件模板,因为当您更新Xcode时,您将丢失它们。将要更改的文件模板复制到用户文件模板位置。
~/Library/Developer/Xcode/Templates/File Templates您可能需要手动创建此路径中的某些文件夹。您可能还希望创建一个额外的文件夹来存储模板,以便在创建新文件时更容易找到模板。
将文件模板复制到用户文件模板位置后,可以对文件进行更改。
发布于 2021-05-25 14:08:25
在Mark的回答上添加/详细说明:
Xcode路径是为我准备的:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates目标路径确实匹配(但模板文件夹不存在),所以我这样做了:
cp -fr /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates ~/Library/Developer/Xcode现在,C++模板在哪里?隐藏在以下位置:
/Users/michael/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/C++ File.xctemplate在C++项目模板文件中,<cstdio>要做什么??苹果身边的某个人已经在这里睡了几十年了。
无论如何,它可以工作,但我现在有重复的条目。我尝试删除原始文件夹,但不起作用:sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates
但不管怎样。只需选择正确的文件即可。您还可以重命名"C++ File.xctemplate“名称...在"File“之前的任何东西在Xcode中似乎都是一个标签。
或者,您可以直接在/Applications/Xcode.app中更改模板,但在更新后会被覆盖。
https://stackoverflow.com/questions/60755850
复制相似问题