![]() |
![]() |
|
|
|
|
|
This is a little script that calculates the shortest relative path from a directory to one or more arbitrary paths. For example: [n8gray@golux photos]$ pwd /Users/n8gray/web/Sites/photos [n8gray@golux photos]$ relpath . ~/Pictures/ ../../Pictures [n8gray@golux photos]$ relpath /usr/local /usr/local/bin/nedit ./bin/nedit [n8gray@golux photos]$ relpath / / ./ [n8gray@golux photos]$ relpath . .. ../ [n8gray@golux photos]$ relpath . /usr/local ~/bin ../photos/Cats/index.html ../../../../usr/local ../../bin ./Cats/index.html Caveat Emptor: Symbolic links are resolved when you give a relative path but not when you give an absolute path. I intend to make this more deterministic and controllable in the future. Get it here. Python 2.3 required.
|
|
![]() |
![]() |




Too bad OS X can’t get their S#%T together and just work out the symlink thing once and for all.
Having both Aliases and symlinks is stupid, esp when Aliases just show up as zero length files (under HFS+ at least) and can’t be followed from the command line.
Then, unless it’s my imagination (or a bad version of OS X bash), it seems like relative paths in OS X symlinks only work HALF the time. The other part of the time, you wind up with the absolute path you never wanted and a bald front tire.
–
Jefe