diff options
author | Viktor Ferenczi <viktor@ferenczi.eu> | 2018-03-10 18:37:33 +0100 |
---|---|---|
committer | Viktor Ferenczi <viktor@ferenczi.eu> | 2018-03-11 14:55:50 +0100 |
commit | 272ecddb2859e3c184886bc2d142e2e329b8ae83 (patch) | |
tree | 8f76dbf6737196fbb66a1b379e1f18437f609173 /core/SCsub | |
parent | eceba5aa6a36521c878cf976845123e820d27161 (diff) |
Properly closing all files in Python code
Diffstat (limited to 'core/SCsub')
-rw-r--r-- | core/SCsub | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/SCsub b/core/SCsub index af83b49fea..ea15ab12b5 100644 --- a/core/SCsub +++ b/core/SCsub @@ -18,9 +18,8 @@ gd_cpp = '#include "project_settings.h"\n' gd_cpp += gd_inc gd_cpp += "void ProjectSettings::register_global_defaults() {\n" + gd_call + "\n}\n" -f = open("global_defaults.gen.cpp", "w") -f.write(gd_cpp) -f.close() +with open("global_defaults.gen.cpp", "w") as f: + f.write(gd_cpp) # Generate AES256 script encryption key @@ -47,9 +46,8 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" print("Invalid AES256 encryption key, not 64 bits hex: " + e) -f = open("script_encryption_key.gen.cpp", "w") -f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") -f.close() +with open("script_encryption_key.gen.cpp", "w") as f: + f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") # Add required thirdparty code. Header paths are hardcoded, we don't need to append |