/* * 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); }