static public Method

Dir.pwd

Dir.getwd  string
Dir.pwd  string

Returns the path to the current working directory of this process as a string.

Dir.chdir("/tmp")   #=> 0
Dir.getwd           #=> "/tmp"

Source Code

/*
*  call-seq:
*     Dir.getwd => string
*     Dir.pwd => string
*
*  Returns the path to the current working directory of this process as
*  a string.
*
*     Dir.chdir("/tmp")   #=> 0
*     Dir.getwd           #=> "/tmp"
*/
static VALUE
dir_s_getwd(dir)
   VALUE dir;
{
   char *path;
   VALUE cwd;

   rb_secure(4);
   path = my_getcwd();
   cwd = rb_tainted_str_new2(path);

   free(path);
   return cwd;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.