From: Ben Noordhuis Date: Fri, 27 Mar 2015 00:07:07 +0000 (+0100) Subject: js2c: fix module id generation on windows X-Git-Tag: v1.6.3~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36f017afaf034ff858b86ad0655032b229d9c8f8;p=platform%2Fupstream%2Fnodejs.git js2c: fix module id generation on windows Fix a regression that was introduced in commit 2db758c ("iojs: introduce internal modules") where the computed id for "config.gypi" on Windows was not "config" but an empty string. With an empty string, the build succeeds but the binary is unusable: startup.processConfig() in src/node.js chokes on the missing .config property. PR-URL: https://github.com/iojs/io.js/pull/1281 Reviewed-By: Vladimir Kurchatkin --- diff --git a/tools/js2c.py b/tools/js2c.py index cc2c304..418d985 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -293,7 +293,17 @@ def JS2C(source, target): lines = ExpandMacros(lines, macros) lines = CompressScript(lines, do_jsmin) data = ToCArray(s, lines) - id = '/'.join(re.split('/|\\\\', s)[1:]).split('.')[0] + + # On Windows, "./foo.bar" in the .gyp file is passed as "foo.bar" + # so don't assume there is always a slash in the file path. + if '/' in s or '\\' in s: + id = '/'.join(re.split('/|\\\\', s)[1:]) + else: + id = s + + if '.' in id: + id = id.split('.', 1)[0] + if delay: id = id[:-6] if delay: delay_ids.append((id, len(lines)))