Don't modify file if contents hasn't changed.
This commit is contained in:
parent
9d716def9d
commit
8179a9ea2e
|
@ -23,6 +23,9 @@ def write_to_file(filename, contents, force_unix=False):
|
|||
newline = None
|
||||
if force_unix:
|
||||
newline = "\n"
|
||||
if os.path.exists(filename):
|
||||
if open(filename, "r", newline=newline).read() == contents:
|
||||
return
|
||||
with open(filename, "w", newline=newline) as f:
|
||||
f.write(contents)
|
||||
|
||||
|
|
Loading…
Reference in New Issue