mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
19 lines
465 B
Swift
19 lines
465 B
Swift
import Foundation
|
|
import PathKit
|
|
import Yams
|
|
|
|
public func loadYamlDictionary(path: Path) throws -> [String: Any] {
|
|
let string: String = try path.read()
|
|
if string == "" {
|
|
return [:]
|
|
}
|
|
|
|
let resolver = Resolver.default
|
|
.removing(.null) // remove rule so that empty quotes are treated as empty strings
|
|
|
|
guard let yaml = try Yams.load(yaml: string, resolver) else {
|
|
return [:]
|
|
}
|
|
return yaml as? [String: Any] ?? [:]
|
|
}
|