[macruby-changes] [1617] MacRuby/branches/experimental/file.c

source_changes at macosforge.org source_changes at macosforge.org
Wed May 27 14:28:06 PDT 2009


Revision: 1617
          http://trac.macosforge.org/projects/ruby/changeset/1617
Author:   lsansonetti at apple.com
Date:     2009-05-27 14:28:05 -0700 (Wed, 27 May 2009)
Log Message:
-----------
added IO#stat

Modified Paths:
--------------
    MacRuby/branches/experimental/file.c

Modified: MacRuby/branches/experimental/file.c
===================================================================
--- MacRuby/branches/experimental/file.c	2009-05-27 21:20:26 UTC (rev 1616)
+++ MacRuby/branches/experimental/file.c	2009-05-27 21:28:05 UTC (rev 1617)
@@ -796,15 +796,12 @@
 static VALUE
 rb_io_stat(VALUE obj, SEL sel)
 {
-    //     rb_io_t *fptr;
-    //     struct stat st;
-    // 
-    //     GetOpenFile(obj, fptr);
-    //     if (fstat(fptr->fd, &st) == -1) {
-    // rb_sys_fail(fptr->path);
-    //     }
-    //     return stat_new(&st);
-    rb_notimplement();
+    struct stat st;
+    struct rb_io_t *io = ExtractIOStruct(obj);
+    if (fstat(io->fd, &st) == -1) {
+	rb_sys_fail(RSTRING_PTR(io->path));
+    }
+    return stat_new(&st);
 }
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090527/ba1435fb/attachment.html>


More information about the macruby-changes mailing list