static public Method

File.file?(p1)

File.file?(file_name)    true or false

Returns true if the named file exists and is a regular file.

Source Code

/*
* call-seq:
*    File.file?(file_name)   => true or false
*
* Returns <code>true</code> if the named file exists and is a
* regular file.
*/

static VALUE
test_f(obj, fname)
   VALUE obj, fname;
{
   struct stat st;

   if (rb_stat(fname, &st) < 0) return Qfalse;
   if (S_ISREG(st.st_mode)) return Qtrue;
   return Qfalse;
}
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.