static public Method

Dir.mkdir(...)

Dir.mkdir( string [, integer] )  0

Makes a new directory named by string, with permissions specified by the optional parameter anInteger. The permissions may be modified by the value of File::umask, and are ignored on NT. Raises a SystemCallError if the directory cannot be created. See also the discussion of permissions in the class documentation for File.

Source Code

/*
*  call-seq:
*     Dir.mkdir( string [, integer] ) => 0
*
*  Makes a new directory named by <i>string</i>, with permissions
*  specified by the optional parameter <i>anInteger</i>. The
*  permissions may be modified by the value of
*  <code>File::umask</code>, and are ignored on NT. Raises a
*  <code>SystemCallError</code> if the directory cannot be created. See
*  also the discussion of permissions in the class documentation for
*  <code>File</code>.
*
*/
static VALUE
dir_s_mkdir(argc, argv, obj)
   int argc;
   VALUE *argv;
   VALUE obj;
{
   VALUE path, vmode;
   int mode;

   if (rb_scan_args(argc, argv, "11", &path, &vmode) == 2) {
       mode = NUM2INT(vmode);
   }
   else {
       mode = 0777;
   }

   check_dirname(&path);
   if (mkdir(RSTRING(path)->ptr, mode) == -1)
       rb_sys_fail(RSTRING(path)->ptr);

   return INT2FIX(0);
}
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.