From 2e283083e64491e86120d12b284a1e5555501bd8 Mon Sep 17 00:00:00 2001 From: Pablo Olmos de Aguilera Corradini Date: Tue, 1 Apr 2014 10:20:19 -0300 Subject: mkrc with relative filenames inside dotted dir This is best explained with an example. If I want to track a file like `~/.bundle/config`, the correct way would be: ~$ mkrc ~/.bundle/config --> ~/.dotfiles/bundle/config But if you are already inside the directory, say: ~/.bundle $ and you ran: ~/.bundle $ mkrc con # for autocomplete ~/.bundle $ mkrc config --> ~/.dotfiles/.config Which is obviously not what you meant. This basically checks first if the file exists in the current working directory and if it is, it's expand the full path. ~/.bundle $ mkrc config --> ~/.dotfiles/bundle/config --- bin/mkrc.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bin') diff --git a/bin/mkrc.in b/bin/mkrc.in index 398996a..e173eae 100755 --- a/bin/mkrc.in +++ b/bin/mkrc.in @@ -78,6 +78,10 @@ if [ $force_symlink -eq 1 ]; then fi for file in $files; do + case "$file" in + /*) break;; + *) [ -e "$PWD/$file" ] && file="$PWD/$file" + esac dotless="$(de_dot "$file")" dest="$(destination "$DOTFILES_DIR" "$dotless" $in_host "$tag")" mkdir -p "$dest/$(dirname "$dotless")" -- cgit v1.2.3