@@ -230,7 +230,7 @@ def generate_version_header(module_version_string=""):
230
230
231
231
# NOTE: It is safe to generate these files here, since this is still executed serially.
232
232
233
- f = open ("core/version_generated.gen.h" , "w" )
233
+ f = open ("core/version_generated.gen.h" , "w" , encoding = "utf-8" , newline = " \n " )
234
234
f .write (
235
235
"""/* THIS FILE IS GENERATED DO NOT EDIT */
236
236
#ifndef VERSION_GENERATED_GEN_H
@@ -253,7 +253,7 @@ def generate_version_header(module_version_string=""):
253
253
)
254
254
f .close ()
255
255
256
- fhash = open ("core/version_hash.gen.cpp" , "w" )
256
+ fhash = open ("core/version_hash.gen.cpp" , "w" , encoding = "utf-8" , newline = " \n " )
257
257
fhash .write (
258
258
"""/* THIS FILE IS GENERATED DO NOT EDIT */
259
259
#include "core/version.h"
@@ -384,7 +384,7 @@ def is_module(path):
384
384
385
385
386
386
def write_disabled_classes (class_list ):
387
- f = open ("core/disabled_classes.gen.h" , "w" )
387
+ f = open ("core/disabled_classes.gen.h" , "w" , encoding = "utf-8" , newline = " \n " )
388
388
f .write ("/* THIS FILE IS GENERATED DO NOT EDIT */\n " )
389
389
f .write ("#ifndef DISABLED_CLASSES_GEN_H\n " )
390
390
f .write ("#define DISABLED_CLASSES_GEN_H\n \n " )
@@ -435,7 +435,7 @@ def write_modules(modules):
435
435
)
436
436
437
437
# NOTE: It is safe to generate this file here, since this is still executed serially
438
- with open ("modules/register_module_types.gen.cpp" , "w" ) as f :
438
+ with open ("modules/register_module_types.gen.cpp" , "w" , encoding = "utf-8" , newline = " \n " ) as f :
439
439
f .write (modules_cpp )
440
440
441
441
@@ -757,7 +757,7 @@ def generate_cpp_hint_file(filename):
757
757
pass
758
758
else :
759
759
try :
760
- with open (filename , "w" ) as fd :
760
+ with open (filename , "w" , encoding = "utf-8" , newline = " \n " ) as fd :
761
761
fd .write ("#define GDCLASS(m_class, m_inherits)\n " )
762
762
except OSError :
763
763
print ("Could not write cpp.hint file." )
@@ -1062,7 +1062,7 @@ def get_size(self, start_path="."):
1062
1062
def progress_finish (target , source , env ):
1063
1063
nonlocal node_count , progressor
1064
1064
try :
1065
- with open (node_count_fname , "w" ) as f :
1065
+ with open (node_count_fname , "w" , encoding = "utf-8" , newline = " \n " ) as f :
1066
1066
f .write ("%d\n " % node_count )
1067
1067
progressor .delete (progressor .file_list ())
1068
1068
except Exception :
@@ -1092,7 +1092,7 @@ def dump(env):
1092
1092
def non_serializable (obj ):
1093
1093
return "<<non-serializable: %s>>" % (type (obj ).__qualname__ )
1094
1094
1095
- with open (".scons_env.json" , "w" ) as f :
1095
+ with open (".scons_env.json" , "w" , encoding = "utf-8" , newline = " \n " ) as f :
1096
1096
dump (env .Dictionary (), f , indent = 4 , default = non_serializable )
1097
1097
1098
1098
@@ -1294,7 +1294,7 @@ def format_key_value(v):
1294
1294
1295
1295
filters_template = filters_template .replace ("%%HASH%%" , md5 )
1296
1296
1297
- with open (f"{ project_name } .vcxproj.filters" , "w" ) as f :
1297
+ with open (f"{ project_name } .vcxproj.filters" , "w" , encoding = "utf-8" , newline = " \n " ) as f :
1298
1298
f .write (filters_template )
1299
1299
1300
1300
envsources = []
@@ -1469,7 +1469,9 @@ def format_key_value(v):
1469
1469
cmd = " ^& " .join (common_build_prefix + [" " .join ([commands ] + cmd_clean )])
1470
1470
props_template = props_template .replace ("%%CLEAN%%" , cmd )
1471
1471
1472
- with open (f"{ project_name } .{ platform } .{ target } .{ arch } .generated.props" , "w" ) as f :
1472
+ with open (
1473
+ f"{ project_name } .{ platform } .{ target } .{ arch } .generated.props" , "w" , encoding = "utf-8" , newline = "\n "
1474
+ ) as f :
1473
1475
f .write (props_template )
1474
1476
1475
1477
proj_uuid = str (uuid .uuid4 ())
@@ -1572,7 +1574,7 @@ def format_key_value(v):
1572
1574
proj_template = proj_template .replace ("%%DEFAULT_ITEMS%%" , "\n " .join (all_items ))
1573
1575
proj_template = proj_template .replace ("%%PROPERTIES%%" , "\n " .join (properties ))
1574
1576
1575
- with open (f"{ project_name } .vcxproj" , "w" ) as f :
1577
+ with open (f"{ project_name } .vcxproj" , "w" , encoding = "utf-8" , newline = " \n " ) as f :
1576
1578
f .write (proj_template )
1577
1579
1578
1580
if not get_bool (original_args , "vsproj_props_only" , False ):
@@ -1583,7 +1585,7 @@ def format_key_value(v):
1583
1585
sln_template = sln_template .replace ("%%SECTION1%%" , "\n " .join (section1 ))
1584
1586
sln_template = sln_template .replace ("%%SECTION2%%" , "\n " .join (section2 ))
1585
1587
1586
- with open (f"{ project_name } .sln" , "w" ) as f :
1588
+ with open (f"{ project_name } .sln" , "w" , encoding = "utf-8" , newline = " \n " ) as f :
1587
1589
f .write (sln_template )
1588
1590
1589
1591
if get_bool (original_args , "vsproj_gen_only" , True ):
0 commit comments