From 4362934dbfe3178e59493962271627f117e4ab6c Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Thu, 27 Feb 2014 16:42:00 +0100 Subject: -d is relative to the $PWD This case fails: ~% lsrc -d foo -d bar /home/mike/.zshrc:/home/mike/foo/zshrc Because: skipping non-existent directory: /home/mike/foo/bar However, giving the absolute path fixes it: ~% lsrc -d $PWD/foo -d $PWD/bar /home/mike/.zshrc:/home/mike/foo/zshrc /home/mike/.vimrc:/home/mike/bar/vimrc In this commit we fix this by storing the user's working directory when they start, and always `cd`ing back before changing dotfile directory. In this way they are always relative to the current working directory. Fixes #21. --- bin/lsrc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bin') diff --git a/bin/lsrc b/bin/lsrc index 61ba0c4..724fb44 100755 --- a/bin/lsrc +++ b/bin/lsrc @@ -270,7 +270,11 @@ $DEBUG "COPY_ALWAYS: $COPY_ALWAYS" : ${SYMLINK_DIRS:=""} $DEBUG "SYMLINK_DIRS: $SYMLINK_DIRS" +relative_root_dir=$PWD + for DOTFILES_DIR in $DOTFILES_DIRS; do + cd $relative_root_dir + if is_relative $DOTFILES_DIR; then DOTFILES_DIR=$PWD/$DOTFILES_DIR fi -- cgit v1.2.3