[macruby-changes] [1745] MacRuby/branches/experimental/load.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 4 22:54:01 PDT 2009


Revision: 1745
          http://trac.macosforge.org/projects/ruby/changeset/1745
Author:   lsansonetti at apple.com
Date:     2009-06-04 22:54:01 -0700 (Thu, 04 Jun 2009)
Log Message:
-----------
fixed the require of Ruby scripts where the path is fully-qualified (contains the extension). Note: we really need to rewrite load.c one day.

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

Modified: MacRuby/branches/experimental/load.c
===================================================================
--- MacRuby/branches/experimental/load.c	2009-06-05 02:00:28 UTC (rev 1744)
+++ MacRuby/branches/experimental/load.c	2009-06-05 05:54:01 UTC (rev 1745)
@@ -117,7 +117,7 @@
     return loading_table;
 }
 
-static int
+int
 rb_feature_p(const char *feature, const char *ext, int rb, int expanded,
 	     const char **fn)
 {
@@ -153,7 +153,8 @@
 	    if (!load_path) {
 		load_path = rb_get_load_path();
 	    }
-	    if (!(p = loaded_feature_path(f, n, feature, len, type, load_path))) {
+	    if (!(p = loaded_feature_path(f, n, feature, len, type,
+			    load_path))) {
 		continue;
 	    }
 	    f += RSTRING_LEN(p) + 1;
@@ -176,7 +177,9 @@
     }
     VALUE feature_str = rb_str_new2(feature);
     if (rb_ary_includes(get_loading_table(), feature_str)) {
-	if (!ext) return 'u';
+	if (!ext) {
+	    return 'u';
+	}
 	return !IS_RBEXT(ext) ? 's' : 'r';
     }
     rb_ary_push(get_loading_table(), feature_str);
@@ -377,9 +380,9 @@
 	    if ((tmp = rb_find_file(fname)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
 		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
-		if (!rb_feature_p(ftptr, ext, Qtrue, Qtrue, 0)) {
+//		if (!rb_feature_p(ftptr, ext, Qtrue, Qtrue, 0)) {
 		    *path = tmp;
-		}
+//		}
 		return 'r';
 	    }
 	    return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090604/1dc6cd16/attachment.html>


More information about the macruby-changes mailing list