On 16/02/2009, at 6:25 PM, Xavier wrote:
Before moving forward, I have a question : is there any good and portable way to convert between absolute and relative paths? I don't see any reason for doing any symlinks resolution anywhere. The only thing we need is to convert a given path (which can be either absolute or relative) to an absolute path. We need this because we are changing directories, and these paths have to stay valid so have to be absolute.
After a bit of Googling I haven't been able to find a solution. On the contrary, many posts indicate that there is no cross-platform way - at least not without introducing huge dependencies (python/ruby/etc). It's weird considering that there's a standard C function[1] which does exactly this. A semi-ugly solution would be to provide an executable which simply calls this function, as part of the pacman package. However, if the speed difference is not that important, the bash implementation is a nicer solution. [1]: http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html