extras: file_to_object: basic file name escape (fixes issue on Windows)

This commit is contained in:
Jérôme Carretero 2015-03-02 18:22:07 -05:00
parent c47b9bcd85
commit 340551d8a0
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,10 @@ import os, binascii
from waflib import Task, Utils, TaskGen, Errors from waflib import Task, Utils, TaskGen, Errors
def filename_c_escape(x):
return x.replace("\\", "\\\\")
class file_to_object_s(Task.Task): class file_to_object_s(Task.Task):
color = 'CYAN' color = 'CYAN'
dep_vars = ('DEST_CPU', 'DEST_BINFMT') dep_vars = ('DEST_CPU', 'DEST_BINFMT')
@ -59,6 +63,7 @@ class file_to_object_s(Task.Task):
else: else:
raise Errors.WafError("Unsupported DEST_CPU, please report bug!") raise Errors.WafError("Unsupported DEST_CPU, please report bug!")
file = filename_c_escape(file)
name = "_binary_" + "".join(name) name = "_binary_" + "".join(name)
rodata = ".section .rodata" rodata = ".section .rodata"
if self.env.DEST_BINFMT == "mac-o": if self.env.DEST_BINFMT == "mac-o":