mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
only write plists if file has changed
This commit is contained in:
@@ -43,6 +43,11 @@ public class ProjectWriter {
|
||||
|
||||
private func writePlist(_ plist: [String: Any], path: String) throws {
|
||||
let path = project.basePath + path
|
||||
if path.exists, let data: Data = try? path.read(),
|
||||
let existingPlist = (try? PropertyListSerialization.propertyList(from: data, format: nil)) as? [String: Any], NSDictionary(dictionary: plist).isEqual(to: existingPlist) {
|
||||
// file is the same
|
||||
return
|
||||
}
|
||||
let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
|
||||
try? path.delete()
|
||||
try path.parent().mkpath()
|
||||
|
||||
Reference in New Issue
Block a user