summaryrefslogtreecommitdiffstats
path: root/platform_methods.py
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-10 21:13:18 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-10 21:13:18 +0100
commit53701a02341eef7ec3ebca69b673d31d58760e45 (patch)
tree0a8f0d6c04955b6d66c088d4a501075bd8bfd385 /platform_methods.py
parentaf527e53c450eb957bfa6a5446a095b190ebcae9 (diff)
parentfb299d0fb134c603eafe7737bab8d22ec0b1cd59 (diff)
downloadredot-engine-53701a02341eef7ec3ebca69b673d31d58760e45.tar.gz
Merge pull request #89361 from Repiteo/scons/with-statement
SCons: Ensure `with` statement where applicable
Diffstat (limited to 'platform_methods.py')
-rw-r--r--platform_methods.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/platform_methods.py b/platform_methods.py
index 91c1388288..43e6e4f799 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -124,17 +124,15 @@ def generate_export_icons(platform_path, platform_name):
svg_names.append("run_icon")
for name in svg_names:
- svgf = open(export_path + "/" + name + ".svg", "rb")
- b = svgf.read(1)
- svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
- svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "'
- while len(b) == 1:
- svg_str += "\\" + hex(ord(b))[1:]
+ with open(export_path + "/" + name + ".svg", "rb") as svgf:
b = svgf.read(1)
+ svg_str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
+ svg_str += " static const char *_" + platform_name + "_" + name + '_svg = "'
+ while len(b) == 1:
+ svg_str += "\\" + hex(ord(b))[1:]
+ b = svgf.read(1)
- svg_str += '";\n'
-
- svgf.close()
+ svg_str += '";\n'
# NOTE: It is safe to generate this file here, since this is still executed serially.
wf = export_path + "/" + name + "_svg.gen.h"