Skip to content

Commit 36f017a

Browse files
committed
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: #1281 Reviewed-By: Vladimir Kurchatkin <[email protected]>
1 parent 2903410 commit 36f017a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/js2c.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,17 @@ def JS2C(source, target):
293293
lines = ExpandMacros(lines, macros)
294294
lines = CompressScript(lines, do_jsmin)
295295
data = ToCArray(s, lines)
296-
id = '/'.join(re.split('/|\\\\', s)[1:]).split('.')[0]
296+
297+
# On Windows, "./foo.bar" in the .gyp file is passed as "foo.bar"
298+
# so don't assume there is always a slash in the file path.
299+
if '/' in s or '\\' in s:
300+
id = '/'.join(re.split('/|\\\\', s)[1:])
301+
else:
302+
id = s
303+
304+
if '.' in id:
305+
id = id.split('.', 1)[0]
306+
297307
if delay: id = id[:-6]
298308
if delay:
299309
delay_ids.append((id, len(lines)))

0 commit comments

Comments
 (0)