summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2014-02-27 16:42:00 +0100
committerGravatar Mike Burns <mike@mike-burns.com>2014-02-27 16:42:00 +0100
commit4362934dbfe3178e59493962271627f117e4ab6c (patch)
treea9898a987dc74c6fd94ba6c13d141fd9a74e7b9e /bin
parent95128e051aa0928cbaf97da729b1b9f8df562ed1 (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')
-rwxr-xr-xbin/lsrc4
1 files changed, 4 insertions, 0 deletions
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