GiselleSerate / myaliases

Useful shell aliases and functions.
6 stars 1 forks source link

cds's readlink is not supported on all systems #19

Closed aryarm closed 6 years ago

aryarm commented 6 years ago

The readlink command, which cds uses to get the absolute, target path for a symlink, is not supported on all systems, especially Macs. It apparently doesn't have good alternatives.

aryarm commented 6 years ago

Things we can do:

GiselleSerate commented 6 years ago

I think I also use this in my install script, so this is something we should consider handling. NOTE: I'm now using realpath and it seems to be working. (See my install script for details.) Does it work for all systems, though? EDIT: According to #13, it doesn't seem like realpath is universally supported either?

GiselleSerate commented 6 years ago

For posterity (meaning us in about a week, probably): We're using a C realpath method. (Executable included in repo so users don't have to do stuff.)

aryarm commented 6 years ago

Do we see ourselves ever needing the C code? What are your feelings about keeping it?

aryarm commented 6 years ago

Also, currently realpath is called using the ./realpath notation. However, this allows realpath to only be called from executables in the same directory as realpath (ie the cds command can't call it). Maybe we could create an alias function for realpath in .bash_nav? Would that solve the problem? EDIT: I guess that would make .bash_nav a dependency of .bash_cds. Ugh.

aryarm commented 6 years ago

For posterity, our current plan is to use setup to create a variable accessible to all files that are included by .included. This variable would hold a string representing the path to the repository directory. Then, all of the other files in the repository could use this variable directly or use it to call realpath. See issue #25.