User Tools

Site Tools


realpath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

realpath [2006/07/11 04:57] (current)
Line 1: Line 1:
 +# $EPIC: realpath.txt,​v 1.1.1.1 2006/07/11 04:57:43 jnelson Exp $
 +======Synopsis:​======
 +$__realpath__(<​filepath>​)
 +
 +======Technical:​======
 +   * If the <​filepath>​ argument is omitted the empty string is returned.
 +   * If the operating system does not have the realpath(3) function call, the <​filepath>​ argument is returned.
 +   * All directories,​ if any, in <​filepath>​ must exist; if any of them do not exist the empty string is returned.
 +   * The return function is the full absolute path of <​filepath>​ with all symbolic links, `.', `..' and extra '/'​s references resolved.
 +   * This function calls the operating system'​s realpath(3) function.
 +
 +======Practical:​======
 +Useful if you want to find the absolute path of filename with '​.'​ or
 +'​..'​ or symbolic links in it.
 +
 +======Returns:​======
 +The absolute path equivalent of <​filepath>​
 +
 +======Examples:​======
 +If /home is a symbolic link to /usr/home, and /usr/local is a link
 +to /local, then
 +
 +<​file>​
 +$realpath(/​home/​../​local/​src) ​ returns "/​local/​src"​
 +
 + ​(/​home -> /usr/home
 +  ..    -> /usr
 +  local -> /local
 +  src   -> /local/src)
 +</​file>​
 +
  
realpath.txt ยท Last modified: 2006/07/11 04:57 (external edit)