[macruby-changes] [1005] MacRuby/branches/experimental/file.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 19 21:31:15 PDT 2009
Revision: 1005
http://trac.macosforge.org/projects/ruby/changeset/1005
Author: lsansonetti at apple.com
Date: 2009-03-19 21:31:15 -0700 (Thu, 19 Mar 2009)
Log Message:
-----------
reimplemented rb_stat()
Modified Paths:
--------------
MacRuby/branches/experimental/file.c
Modified: MacRuby/branches/experimental/file.c
===================================================================
--- MacRuby/branches/experimental/file.c 2009-03-20 04:29:33 UTC (rev 1004)
+++ MacRuby/branches/experimental/file.c 2009-03-20 04:31:15 UTC (rev 1005)
@@ -710,19 +710,16 @@
static int
rb_stat(VALUE file, struct stat *st)
{
- // VALUE tmp;
- //
- // rb_secure(2);
- // tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io");
- // if (!NIL_P(tmp)) {
- // rb_io_t *fptr;
- //
- // GetOpenFile(tmp, fptr);
- // return fstat(fptr->fd, st);
- // }
- // FilePathValue(file);
- // return stat(StringValueCStr(file), st);
- rb_notimplement();
+ VALUE tmp;
+
+ rb_secure(2);
+ tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io");
+ if (!NIL_P(tmp)) {
+ rb_io_t *io_struct = ExtractIOStruct(tmp);
+ return fstat(io_struct->fd, st);
+ }
+ FilePathValue(file);
+ return stat(StringValueCStr(file), st);
}
#ifdef _WIN32
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090319/0c2839ec/attachment.html>
More information about the macruby-changes
mailing list