Ruby Forum Ruby-core > absolute_path() Implementation patch for 1.9 trunk

Posted by C.E. Thornton (Guest)
on 14.08.2008 10:27
(Received via mailing list)
Core,

  I have attached a patch to the latest 1.9 trunk
to implement 'absolute_path()'. This function
expands relative paths to an absolute path.

However, absolute_path does NOT convert
directories starting with a tilde (~).


----- absolute_path documentation ------
/*
 *  call-seq:
 *     File.absolute_path(file_name [, dir_string] ) -> abs_file_name
 *
 *  Converts a pathname to an absolute pathname. Relative paths are
 *  referenced from the current working directory of the process unless
 *  <i>dir_string</i> is given, in which case it will be used as the
 *  starting point. If the given pathname starts with a 
``<code>~</code>''
 *  it is NOT expanded, it is treated as a normal directory name.
 *
 *   File.absolute_path("~oracle/bin") #=> <relatvive path>/~oracle/bin"
 */

Chuck T.