Skip to content

Commit

Permalink
fix: Use safe path functions in setup (#86)
Browse files Browse the repository at this point in the history
This commit replaces string concatenation with dedicated path functions in the `setup` function.
  • Loading branch information
demurgos authored and coreyfarrell committed May 10, 2019
1 parent da05012 commit 4103f72
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,17 @@ function setup (argv, env) {
'SET PATHEXT=%PATHEXT:;.JS;=;%\r\n' +
'"' + process.execPath + '"' + ' "%~dp0\\.\\node" %*\r\n'

fs.writeFileSync(workingDir + '/node.cmd', cmdShim)
fs.chmodSync(workingDir + '/node.cmd', '0755')
fs.writeFileSync(path.join(workingDir, 'node.cmd'), cmdShim)
fs.chmodSync(path.join(workingDir, 'node.cmd'), '0755')
}
fs.writeFileSync(workingDir + '/node', shim)
fs.chmodSync(workingDir + '/node', '0755')
fs.writeFileSync(path.join(workingDir, 'node'), shim)
fs.chmodSync(path.join(workingDir, 'node'), '0755')
const cmdname = path.basename(process.execPath).replace(/\.exe$/i, '')
if (cmdname !== 'node') {
fs.writeFileSync(workingDir + '/' + cmdname, shim)
fs.chmodSync(workingDir + '/' + cmdname, '0755')
fs.writeFileSync(path.join(workingDir, cmdname), shim)
fs.chmodSync(path.join(workingDir, cmdname), '0755')
}
fs.writeFileSync(workingDir + '/settings.json', settings)
fs.writeFileSync(path.join(workingDir, 'settings.json'), settings)

return workingDir
}
Expand Down

0 comments on commit 4103f72

Please sign in to comment.