From 597a09dd76866008dfe1115ace80b4f00dac1019 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 13 Apr 2014 08:36:51 -0700 Subject: [PATCH] on Windows, don't discard the symlink error (#519) --- node/postinstall.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/node/postinstall.js b/node/postinstall.js index 0271c5c66..4f5bdf9b7 100644 --- a/node/postinstall.js +++ b/node/postinstall.js @@ -9,14 +9,14 @@ var jsdocPath = path.resolve( path.join(__dirname, '..') ); var symlinkSrc = path.join( jsdocPath, 'lib', 'jsdoc' ); var symlinkDest = path.join( jsdocPath, 'node_modules', 'jsdoc' ); -function createJunction(err) { +function createJunction(symlinkErr) { fs.symlink(symlinkSrc, symlinkDest, 'junction', function(junctionErr) { if (junctionErr) { console.error('Unable to create a symbolic link or junction from %s to %s.\n' + 'Symbolic link result: %s\nJunction result: %s\n' + 'Make sure you have write privileges in the target directory. ' + 'You may need to run the Windows shell as an administrator.', - symlinkSrc, symlinkDest, err, junctionErr); + symlinkSrc, symlinkDest, symlinkErr, junctionErr); process.exit(1); } else { @@ -48,8 +48,8 @@ function checkLink() { }); } -fs.symlink(symlinkSrc, symlinkDest, 'dir', function(err) { - if (err) { +fs.symlink(symlinkSrc, symlinkDest, 'dir', function(symlinkErr) { + if (symlinkErr) { // Does the symlink already exist? If so, does it point to the right place? fs.lstat(symlinkDest, function(lstatErr, stats) { if ( stats && stats.isSymbolicLink() ) { @@ -57,11 +57,11 @@ fs.symlink(symlinkSrc, symlinkDest, 'dir', function(err) { } // On Windows, try to create a junction instead else if (process.platform.indexOf('win') === 0) { - createJunction(); + createJunction(symlinkErr); } else { console.error('Unable to create a symbolic link from %s to %s. %s\n', symlinkSrc, - symlinkDest, err); + symlinkDest, symlinkErr); process.exit(1); } });