If there are symlinks and you followed them, I think that you cannot know how you reached a file; You can test yourself:
mkdir -p real/subdir ln -s real link
#!/usr/bin/perl use Cwd; for $dir ('real/subdir', '../link/subdir') { print "changing to $dir\n"; chdir $dir; where(); } exit; sub where { print "pwd : ", `pwd`; print "cwd : ", Cwd::cwd, "\n"; print "getcwd : ", Cwd::getcwd, "\n"; print "fastcwd: ", Cwd::fastcwd, "\n"; }
This is true for Linux, I don't know for other file systems. Software like Midnight Commander or Bash shell keep track of the followed path to solve this problem.
Ciao, Valerio
In reply to Re: Verifying Current Working Directory: getcwd() and absolute path
by valdez
in thread Verifying Current Working Directory: getcwd() and absolute path
by hackdaddy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |