diff options
author | Mike Burns <mike@mike-burns.com> | 2014-02-27 16:42:00 +0100 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2014-02-27 16:42:00 +0100 |
commit | 4362934dbfe3178e59493962271627f117e4ab6c (patch) | |
tree | a9898a987dc74c6fd94ba6c13d141fd9a74e7b9e /bin/lsrc | |
parent | 95128e051aa0928cbaf97da729b1b9f8df562ed1 (diff) |
-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.
Diffstat (limited to 'bin/lsrc')
-rwxr-xr-x | bin/lsrc | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |