in reply to Embedded relative paths

[ Your node is unreadable. Please add a <p> tag at the start of every paragraph and add <c>...</c> tags around computer text. ]

platform/process/src/../../data/test.dat
and
platform/data/test.dat

are not necessarily equivalent. For example,

$ readlink -f /tmp/platform/process/src/../../data/test.dat /tmp/platform/process/data/test.dat

Notice that

platform/process/src/../../data/test.dat

is equivalent to

platform/process/data/test.dat

from that directory.

Tools like File::Spec that don't access the disk can't fold away ".." safely. You need Cwd's realpath

$ perl -MCwd=realpath -le'print realpath $ARGV[0]' \ /tmp/platform/process/src/../../data/test.dat /tmp/platform/process/data/test.dat

You can then make it relative again if that's what you desire.

(Yeah, me bad in the CB)

Replies are listed 'Best First'.
Re^2: Embedded relative paths
by ppti (Initiate) on Dec 12, 2009 at 00:51 UTC

    Thanks for your input. Got it.