new(p1)
public
Create a File::Stat object for the given file
name (raising an exception if the file doesn’t exist).
static VALUE
rb_stat_init(VALUE obj, VALUE fname)
{
struct stat st, *nst;
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (STAT(StringValueCStr(fname), &st) == -1) {
rb_sys_fail_path(fname);
}
if (DATA_PTR(obj)) {
xfree(DATA_PTR(obj));
DATA_PTR(obj) = NULL;
}
nst = ALLOC(struct stat);
*nst = st;
DATA_PTR(obj) = nst;
return Qnil;
}