Skip to content

Commit

Permalink
look for setting preset files in multiple places
Browse files Browse the repository at this point in the history
  • Loading branch information
yonaskolb committed Sep 26, 2017
1 parent b46c266 commit 1223404
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Sources/XcodeGenKit/SettingsBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,17 @@ extension SettingsPresetFile {
return group
}
let relativePath = "SettingPresets/\(path).yml"
var settingsPath = Path(Bundle.main.bundlePath) + "../share/xcodegen/\(relativePath)"

if !settingsPath.exists {
// maybe running locally
settingsPath = Path(#file).parent().parent().parent() + relativePath
}
guard settingsPath.exists else {
let possibleSettingsPaths: [Path] = [
Path(relativePath),
Path(Bundle.main.bundlePath) + relativePath,
Path(Bundle.main.bundlePath) + "../share/xcodegen/\(relativePath)",
Path(#file).parent().parent().parent() + relativePath,
]

guard let settingsPath = possibleSettingsPaths.first(where: { $0.exists }) else {
switch self {
case .base, .config, .platform:
print("No \"\(name)\" settings found at \(settingsPath)")
print("No \"\(name)\" settings found")
case .product, .productPlatform:
break
}
Expand Down

0 comments on commit 1223404

Please sign in to comment.