]> git.saurik.com Git - apple/security.git/blob - OSX/shared_regressions/append_log_to_plist.py
Security-59754.60.13.tar.gz
[apple/security.git] / OSX / shared_regressions / append_log_to_plist.py
1 #!/usr/bin/python
2 import sys
3 import Foundation
4
5 plist = sys.argv[1]
6 description = sys.argv[2]
7 operator = sys.argv[3]
8 keyfile = sys.argv[4]
9
10 my_array = Foundation.NSMutableArray.arrayWithContentsOfFile_(plist)
11
12 if my_array is None:
13 my_array = Foundation.NSMutableArray.array()
14
15
16 my_data = Foundation.NSData.dataWithContentsOfFile_(keyfile)
17
18 my_dict = Foundation.NSMutableDictionary.dictionary()
19 my_dict['description'] = description
20 my_dict['operator'] = operator
21 my_dict['key'] = my_data
22
23 my_array.append(my_dict)
24
25 print my_array
26
27 success = my_array.writeToFile_atomically_(plist, 1)
28 if not success:
29 print "plist failed to write!"
30 sys.exit(1)
31