summaryrefslogtreecommitdiff
path: root/bin/lsrc.in
diff options
context:
space:
mode:
authorGravatar Mike Burns and Eric Collins <mike@mike-burns.com>2016-12-23 16:18:40 -0500
committerGravatar Mike Burns and Eric Collins <mike@mike-burns.com>2016-12-26 16:39:20 -0500
commit147a7b66554b2b13bcbf6fec1204e0cc0a1790bf (patch)
tree6539b10986afe5babef3decb2991cd5bb11ac08b /bin/lsrc.in
parent0651e4f5e0e71b57d6564f2f2887ab98f13f1995 (diff)
Handle spaces in dotfile name
In mkrc, separate the list of files with newlines instead of spaces. Change the `$IFS` when iterating to handle this. We hand the file off to rcup, which encodes the file name by replacing spaces with the bell character (`\a`). rcup then sends the file name off to lsrc, which decodes the bell back into a space. The test makes sure an `a` character is in the filename, in case some encoding goes wrong. We use tr(1) instead of sed(1) because tr(1) handles `\a`. Shoutout to Sublime Text 3 for forcing this issue.
Diffstat (limited to 'bin/lsrc.in')
-rwxr-xr-xbin/lsrc.in9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/lsrc.in b/bin/lsrc.in
index 8fb1fcd..b0dc30a 100755
--- a/bin/lsrc.in
+++ b/bin/lsrc.in
@@ -347,7 +347,8 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do
host_files="$DOTFILES_DIR/host-$HOSTNAME"
if [ -d "$host_files" ]; then
pushdir "$(basename "$host_files")"
- for file in ${FILES:-*}; do
+ for escaped_file in ${FILES:-*}; do
+ file="$(decode "$escaped_file")"
dotted=0
if is_excluded "$file" "$undotted_file_globs" "$never_undotted_file_globs"; then
dotted=1
@@ -363,7 +364,8 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do
for tag in $TAGS; do
if [ -d "tag-$tag" ]; then
pushdir "$(basename "tag-$tag")"
- for file in ${FILES:-*}; do
+ for escaped_file in ${FILES:-*}; do
+ file="$(decode "$escaped_file")"
$DEBUG "TAG: $tag, exclude_file_globs: $exclude_file_globs"
dotted=0
if is_excluded "$file" "$undotted_file_globs" "$never_undotted_file_globs"; then
@@ -377,7 +379,8 @@ for DOTFILES_DIR in $DOTFILES_DIRS; do
cd "$DOTFILES_DIR"
- for file in ${FILES:-*}; do
+ for escaped_file in ${FILES:-*}; do
+ file="$(decode "$escaped_file")"
dotted=0
if is_metafile "$file"; then
continue