CMake: only write edited file when changes made

Caused cmake to run after every icon update.
This commit is contained in:
Campbell Barton 2018-04-25 09:57:44 +02:00
parent 0d69dfbfc1
commit d63b66be82
1 changed files with 3 additions and 2 deletions

View File

@ -27,8 +27,9 @@ def edit_text_file(filename, marker_begin, marker_end, content):
return
marker_begin_index += len(marker_begin) + 1
data_update = data[:marker_begin_index] + content + data[marker_end_index:]
with open(filename, 'w', encoding='utf-8') as f:
f.write(data_update)
if data != data_update:
with open(filename, 'w', encoding='utf-8') as f:
f.write(data_update)
BASEDIR = os.path.abspath(os.path.dirname(__file__))