From 439d8d8afe7c1e9c4f6d38613177965e06d2d82c Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 15 Dec 2015 08:56:47 +0000 Subject: [PATCH] Fix issue on non-windows systems when emitting the build rule for the ".NET" bindings example. Previously there was a hack that would to path separator replacement ( '/' -> '\' ) which breaks paths under non-windows platforms. The hack has been made slightly better by doing ( '/' -> os.path.sep). This preserves the existing behaviour under Windows and unbreaks the build on non-windows platforms. I'm not entirely sure why the path replacement needs to be done in the first place. I thought Windows was supposed to support using '/' as a path separator (as well as '/'). Maybe ``csc.exe`` doesn't support these kind of paths? --- scripts/mk_util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 3e65bf782..a0e8300c2 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -1969,9 +1969,11 @@ class DotNetExampleComponent(ExampleComponent): out.write(' /platform:x86') for csfile in get_cs_files(self.ex_dir): out.write(' ') - # HACK - win_ex_dir = self.to_ex_dir.replace('/', '\\') - out.write(os.path.join(win_ex_dir, csfile)) + # HACK: I'm not really sure why csc on Windows need to be + # given Windows style paths (``\``) here. I thought Windows + # supported using ``/`` as a path separator... + relative_path = self.to_ex_dir.replace('/', os.path.sep) + out.write(os.path.join(relative_path, csfile)) out.write('\n') out.write('_ex_%s: %s\n\n' % (self.name, exefile))