@@ -134,6 +134,10 @@ def err(*args):
134
134
print (* args , file = sys .stderr )
135
135
136
136
137
+ def to_unix_path (p ):
138
+ return p .replace (os .path .sep , '/' )
139
+
140
+
137
141
def base64_encode (b ):
138
142
b64 = base64 .b64encode (b )
139
143
return b64 .decode ('ascii' )
@@ -265,18 +269,19 @@ def generate_object_file(data_files):
265
269
err ('embedding %s at %s' % (f .srcpath , f .dstpath ))
266
270
267
271
size = os .path .getsize (f .srcpath )
268
- name = to_asm_string (f .dstpath )
272
+ dstpath = to_asm_string (f .dstpath )
273
+ srcpath = to_unix_path (f .srcpath )
269
274
out .write (dedent (f'''
270
275
.section .rodata.{ f .c_symbol_name } ,"",@
271
276
272
277
# The name of file
273
278
{ f .c_symbol_name } _name:
274
- .asciz "{ name } "
275
- .size { f .c_symbol_name } _name, { len (name )+ 1 }
279
+ .asciz "{ dstpath } "
280
+ .size { f .c_symbol_name } _name, { len (dstpath )+ 1 }
276
281
277
282
# The size of the file followed by the content itself
278
283
{ f .c_symbol_name } :
279
- .incbin "{ f . srcpath } "
284
+ .incbin "{ srcpath } "
280
285
.size { f .c_symbol_name } , { size }
281
286
''' ))
282
287
@@ -462,7 +467,7 @@ def main():
462
467
463
468
for file_ in data_files :
464
469
# name in the filesystem, native and emulated
465
- file_ .dstpath = file_ .dstpath . replace ( os . path . sep , '/' )
470
+ file_ .dstpath = to_unix_path ( file_ .dstpath )
466
471
# If user has submitted a directory name as the destination but omitted
467
472
# the destination filename, use the filename from source file
468
473
if file_ .dstpath .endswith ('/' ):
0 commit comments