Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <vladimir.kurchatkin@gmail.com>
  • Loading branch information
bnoordhuis committed Mar 27, 2015
commit 36f017afaf034ff858b86ad0655032b229d9c8f8
12 changes: 11 additions & 1 deletion tools/js2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down