Permalink
Browse files

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.
  • Loading branch information...
1 parent a5593eb commit 0895ea3e50cbad95ce67460a906323610f1f40a8 @Suor Suor committed Sep 30, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 bin/n
View
11 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"

0 comments on commit 0895ea3

Please sign in to comment.