mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-23 19:36:26 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
25 lines
730 B
Swift
25 lines
730 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] ?? [:]
|
|
}
|
|
|
|
public func dumpYamlDictionary(_ dictionary: [String: Any], path: Path) throws {
|
|
let uncluttered = (dictionary as [String: Any?]).removingEmptyArraysDictionariesAndNils()
|
|
let string: String = try Yams.dump(object: uncluttered)
|
|
try path.write(string)
|
|
}
|