在Xcode中,“位置”下的“首选项”允许手动设置“自定义路径”。我想从命令行读取和写入这些值。我没有在xcodebuild
中看到这样做的选项。
怎么做?
通过设置自定义路径,我可以将它们用于相对路径,这非常有用。
答案 0 :(得分:0)
这是通过使用defaults
命令更新Xcode的NSUserDefaults
来完成的。
https://gist.github.com/brennanMKE/7d9f190859a0f15fdc32c0811bf24386
# Note: Xcode shows these values in Settings -> Locations -> Custom Paths
# Xcode does not hot reload these values so you must restart Xcode to get the changes.
# Define a dictionary entry for LUMBERJACK_DIR with a display name
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict-add LUMBERJACK_DIR "\$LUMBERJACK_DIR"
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 1.0"
# Change the display name
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 2.0"
# View the values which match this key
defaults read com.apple.dt.Xcode IDEApplicationwideBuildSettings | grep LUMBERJACK_DIR
defaults read com.apple.dt.Xcode IDESourceTreeDisplayNames | grep LUMBERJACK_DIR
# Your Xcode project can define the $LUMBERJACK_DIR value in an .xcconfig variable.
# Be sure to add your .xcconfig to your project configuration for your current build configuration.