From 0895ea3e50cbad95ce67460a906323610f1f40a8 Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Mon, 1 Oct 2012 01:25:44 +0800 Subject: [PATCH] Use symlinks instead of copying files upon switch. Bakward incompatable change - any modules and executables such as npm, coffee and even n itself are now diffrent for diffrent node versions. This is probably a good thing anyway. --- bin/n | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/n b/bin/n index a233bdb3..072d7e6e 100755 --- a/bin/n +++ b/bin/n @@ -138,12 +138,11 @@ install_node() { # activate local dir=$VERSIONS_DIR/$version if test -d $dir; then - # TODO: refactor, this is lame - cd $dir \ - && mkdir -p $N_PREFIX/lib/node \ - && cp -fR $dir/include/node $N_PREFIX/include \ - && cp -fR $dir/bin/* $N_PREFIX/bin \ - && cp -fR $dir/lib/node/* $N_PREFIX/lib/node/ . + # symlink everything, purge old copies or symlinks + for d in bin lib share include; do + rm -rf $N_PREFIX/$d + ln -s $dir/$d $N_PREFIX/$d + done # install else local tarball="node-v$version.tar.gz"