summaryrefslogtreecommitdiffstats
path: root/scintilla/scripts/FileGenerator.py
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2015-11-07 12:31:06 +0200
committerXhmikosR <xhmikosr@gmail.com>2015-11-07 12:31:06 +0200
commit017529246a001ffe1df321bd5f799c29aa59d486 (patch)
tree6b9d847225816ca9bedb2cddb63cba47bbefe48e /scintilla/scripts/FileGenerator.py
parent0e976db39a47728f48aed5ef8dbda32cba25afcf (diff)
downloadnotepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.zip
notepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.tar.gz
notepad2-mod-017529246a001ffe1df321bd5f799c29aa59d486.tar.bz2
Update Scintilla to v3.6.2.
Diffstat (limited to 'scintilla/scripts/FileGenerator.py')
-rw-r--r--scintilla/scripts/FileGenerator.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/scintilla/scripts/FileGenerator.py b/scintilla/scripts/FileGenerator.py
index 01a79bf..e2750eb 100644
--- a/scintilla/scripts/FileGenerator.py
+++ b/scintilla/scripts/FileGenerator.py
@@ -137,6 +137,25 @@ def Regenerate(filename, commentPrefix, *lists):
"""
Generate(filename, filename, commentPrefix, *lists)
+def UpdateLineInPlistFile(path, key, value):
+ """Replace a single string value preceded by 'key' in an XML plist file.
+ """
+ lines = []
+ keyCurrent = ""
+ with codecs.open(path, "rb", "utf-8") as f:
+ for l in f.readlines():
+ ls = l.strip()
+ if ls.startswith("<key>"):
+ keyCurrent = ls.replace("<key>", "").replace("</key>", "")
+ elif ls.startswith("<string>"):
+ if keyCurrent == key:
+ start, tag, rest = l.partition("<string>")
+ val, etag, end = rest.partition("</string>")
+ l = start + tag + value + etag + end
+ lines.append(l)
+ contents = "".join(lines)
+ UpdateFile(path, contents)
+
def UpdateLineInFile(path, linePrefix, lineReplace):
lines = []
updated = False