Do not write if not needed

This commit is contained in:
Simon Beginn
2022-03-18 23:50:38 +01:00
parent abb00d3b74
commit 715b0b576e

View File

@@ -55,9 +55,9 @@ def doTheReplace(fromApiStr, toApiStr, fromAuthStr, toAuthStr):
newLines = newLines.replace(base64.b64encode(f'https://{fromApiStr}/subscription'.encode()).decode(), base64.b64encode(f'https://{toApiStr}/subscription'.encode()).decode())
if newLines != lines:
numFiles += 1
fh = open(os.path.join(p, ff), 'w')
fh.writelines(newLines)
fh.close()
fh = open(os.path.join(p, ff), 'w')
fh.writelines(newLines)
fh.close()
except UnicodeDecodeError:
# Brrr - binary files...
pass