summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/link.py5
-rw-r--r--test/tests/link-environment-user-expansion-target.bash17
2 files changed, 20 insertions, 2 deletions
diff --git a/plugins/link.py b/plugins/link.py
index 9e1dce0..483d35e 100644
--- a/plugins/link.py
+++ b/plugins/link.py
@@ -30,9 +30,10 @@ class Link(dotbot.Plugin):
force = source.get('force', force)
relink = source.get('relink', relink)
create = source.get('create', create)
- path = os.path.expandvars(source['path'])
+ path = source['path']
else:
- path = os.path.expandvars(source)
+ path = source
+ path = os.path.expandvars(os.path.expanduser(path))
if create:
success &= self._create(destination)
if force or relink:
diff --git a/test/tests/link-environment-user-expansion-target.bash b/test/tests/link-environment-user-expansion-target.bash
new file mode 100644
index 0000000..9cb3424
--- /dev/null
+++ b/test/tests/link-environment-user-expansion-target.bash
@@ -0,0 +1,17 @@
+test_description='link expands user in target'
+. '../test-lib.bash'
+
+test_expect_success 'setup' '
+echo "apple" > ~/f
+'
+
+test_expect_success 'run' '
+run_dotbot <<EOF
+- link:
+ ~/g: ~/f
+EOF
+'
+
+test_expect_success 'test' '
+grep "apple" ~/g
+'