mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/pathname/pathname.c (path_mkdir): Pathname#mkdir translated
from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc9b6ba611
commit
363ed27fa7
4 changed files with 22 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Sep 15 21:07:06 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/pathname/pathname.c (path_mkdir): Pathname#mkdir translated
|
||||||
|
from pathname.rb.
|
||||||
|
|
||||||
Wed Sep 15 13:37:00 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
Wed Sep 15 13:37:00 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||||
|
|
||||||
* test/net/imap/test_imap.rb: "localhost" not guaranteed to
|
* test/net/imap/test_imap.rb: "localhost" not guaranteed to
|
||||||
|
|
|
@ -494,9 +494,6 @@ class Pathname # * Dir *
|
||||||
Dir.foreach(@path) {|f| yield self.class.new(f) }
|
Dir.foreach(@path) {|f| yield self.class.new(f) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# See <tt>Dir.mkdir</tt>. Create the referenced directory.
|
|
||||||
def mkdir(*args) Dir.mkdir(@path, *args) end
|
|
||||||
|
|
||||||
# See <tt>Dir.rmdir</tt>. Remove the referenced directory.
|
# See <tt>Dir.rmdir</tt>. Remove the referenced directory.
|
||||||
def rmdir() Dir.rmdir(@path) end
|
def rmdir() Dir.rmdir(@path) end
|
||||||
|
|
||||||
|
|
|
@ -881,6 +881,20 @@ path_entries(VALUE self)
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See <tt>Dir.mkdir</tt>. Create the referenced directory.
|
||||||
|
*/
|
||||||
|
static VALUE
|
||||||
|
path_mkdir(int argc, VALUE *argv, VALUE self)
|
||||||
|
{
|
||||||
|
VALUE str = get_strpath(self);
|
||||||
|
VALUE vmode;
|
||||||
|
if (rb_scan_args(argc, argv, "01", &vmode) == 0)
|
||||||
|
return rb_funcall(rb_cDir, rb_intern("mkdir"), 1, str);
|
||||||
|
else
|
||||||
|
return rb_funcall(rb_cDir, rb_intern("mkdir"), 2, str, vmode);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* == Pathname
|
* == Pathname
|
||||||
*
|
*
|
||||||
|
@ -1138,4 +1152,5 @@ Init_pathname()
|
||||||
rb_define_singleton_method(rb_cPathname, "getwd", path_s_getwd, 0);
|
rb_define_singleton_method(rb_cPathname, "getwd", path_s_getwd, 0);
|
||||||
rb_define_singleton_method(rb_cPathname, "pwd", path_s_getwd, 0);
|
rb_define_singleton_method(rb_cPathname, "pwd", path_s_getwd, 0);
|
||||||
rb_define_method(rb_cPathname, "entries", path_entries, 0);
|
rb_define_method(rb_cPathname, "entries", path_entries, 0);
|
||||||
|
rb_define_method(rb_cPathname, "mkdir", path_mkdir, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1191,6 +1191,8 @@ class TestPathname < Test::Unit::TestCase
|
||||||
with_tmpchdir('rubytest-pathname') {|dir|
|
with_tmpchdir('rubytest-pathname') {|dir|
|
||||||
Pathname("d").mkdir
|
Pathname("d").mkdir
|
||||||
assert(File.directory?("d"))
|
assert(File.directory?("d"))
|
||||||
|
Pathname("e").mkdir(0770)
|
||||||
|
assert(File.directory?("d"))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue