Skip to content

Commit e757be6

Browse files
committed
docs: document relative paths
1 parent 0610e8b commit e757be6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

unixshell.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,24 @@ $ sudo ln -s /Applications/VisualDiffer.app/Contents/Helpers/visdiff /usr/bin/vi
4747

4848
VisualDiffer was sandboxed starting from version 1.4.2 and many users found using it very annoying because any comparison prompts to pick folders/files.
4949
This problem was fixed in version 1.4.3 by introducing the so-called "Trusted Paths"; please refer to [Trusted Paths](trustedPaths.html) for further details.
50+
51+
[How visdiff resolves relative paths](#relative_paths)
52+
========================================================
53+
54+
`visdiff` is a sandboxed application. Because of that, even when you launch it from a regular terminal, relative paths are resolved from the home directory of the sandbox container, not from the current working directory of the shell.
55+
56+
This can make VisualDiffer report that a file does not exist because it looks for it in the wrong location.
57+
58+
The most reliable solution is to expand the relative path with `$PWD` so the final path is built from the current working directory before `visdiff` receives it.
59+
60+
Instead of:
61+
62+
{% highlight bash %}
63+
$ visdiff ../myfile.txt
64+
{% endhighlight %}
65+
66+
Use:
67+
68+
{% highlight bash %}
69+
$ visdiff $PWD/../myfile.txt
70+
{% endhighlight %}

0 commit comments

Comments
 (0)