diff --git a/install/MarcMentat/apply_DAMASK_modifications.py b/install/MarcMentat/apply_DAMASK_modifications.py index 3ed167039..60184bafa 100755 --- a/install/MarcMentat/apply_DAMASK_modifications.py +++ b/install/MarcMentat/apply_DAMASK_modifications.py @@ -14,9 +14,8 @@ def copy_and_patch(patch,orig,marc_root,editor): except shutil.SameFileError: pass damask.util.run(f'patch {orig.parent/patch.stem} {patch} -b') - with open(orig.parent/patch.stem) as f_in: + with open(orig.parent/patch.stem) as f_in, open(orig.parent/patch.stem,'w') as f_out: content = f_in.read() - with open(orig.parent/patch.stem,'w') as f_out: f_out.write(content.replace('%INSTALLDIR%',f'{marc_root}').replace('%EDITOR%',editor))