static public Method

File.lstat(p1)

File.lstat(file_name)    stat

Same as File::stat, but does not follow the last symbolic link. Instead, reports on the link itself.

File.symlink("testfile", "link2test")   #=> 0
File.stat("testfile").size              #=> 66
File.lstat("link2test").size            #=> 8
File.stat("link2test").size             #=> 66

Source Code

/*
*  call-seq:
*     File.lstat(file_name)   => stat
*  
*  Same as <code>File::stat</code>, but does not follow the last symbolic
*  link. Instead, reports on the link itself.
*     
*     File.symlink("testfile", "link2test")   #=> 0
*     File.stat("testfile").size              #=> 66
*     File.lstat("link2test").size            #=> 8
*     File.stat("link2test").size             #=> 66
*     
*/

static VALUE
rb_file_s_lstat(klass, fname)
   VALUE klass, fname;
{
#ifdef HAVE_LSTAT
   struct stat st;

   SafeStringValue(fname);
   if (lstat(StringValueCStr(fname), &st) == -1) {
       rb_sys_fail(RSTRING(fname)->ptr);
   }
   return stat_new(&st);
#else
   return rb_file_s_stat(klass, fname);
#endif
}
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.