Skip to content

Commit

Permalink
Use NSDictionary to implement getPlistKey.
Browse files Browse the repository at this point in the history
If the value is UTF-8 (e.g. Chinese characters), "defaults read" would
escape it. This patch would allow UTF-8 plist values to be read.
  • Loading branch information
BillWSY authored and DanTheMan827 committed Feb 18, 2021
1 parent b454a4e commit 70f9ac6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions AppSigner/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,8 @@ class MainView: NSView, URLSessionDataDelegate, URLSessionDelegate, URLSessionDo
return "\(size)B"
}
@objc func getPlistKey(_ plist: String, keyName: String)->String? {
let currTask = Process().execute(defaultsPath, workingDirectory: nil, arguments: ["read", plist, keyName])
if currTask.status == 0 {
return String(currTask.output.dropLast())
} else {
return nil
}
let dictionary = NSDictionary(contentsOfFile: plist);
return dictionary?[keyName] as? String
}

func setPlistKey(_ plist: String, keyName: String, value: String)->AppSignerTaskOutput {
Expand Down

0 comments on commit 70f9ac6

Please sign in to comment.