
25 Jan
2013
25 Jan
'13
5:37 p.m.
Neil Groves wrote:
For illustration: I suspect that the result you want from fn("/usr/sbin/../bin/test1.txt", "/usr/bin/test2.txt") is "/usr/bin" rather than "/usr".
Not necessarily. If /usr/sbin is a symbolic link to, say, /opt/sbin, the 'real' common prefix is not /usr/bin. Depending on the use case, /usr may well be more correct, it being the logical common ancestor (but not the physical common ancestor).