Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Class Method Summary collapse

Class Method Details

.size(rb_path) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'ext/dir_size/dir_size.c', line 27

static VALUE rb_get_size(VALUE rb_self, VALUE rb_path) {
    unsigned long lsize;
    char path[PATH_MAX + 1];
    Check_Type(rb_path, T_STRING);
    strncpy(path, RSTRING_PTR(rb_path), RSTRING_LEN(rb_path));
    path[RSTRING_LEN(rb_path)] = '\0';
    if (get_size(path, &lsize) == -1)
        rb_raise(rb_eRuntimeError, "Dir.size error: %s", strerror(errno));
    else
        return ULONG2NUM(lsize);
}