[macruby-changes] [5046] MacRuby/trunk/load.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 17 05:11:20 PST 2010


Revision: 5046
          http://trac.macosforge.org/projects/ruby/changeset/5046
Author:   watson1978 at gmail.com
Date:     2010-12-17 05:11:17 -0800 (Fri, 17 Dec 2010)
Log Message:
-----------
Kernel.require will load a file path of beginning with "~".

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

path = "~/tmp.rb"
expand = File.expand_path(path)

File.open(expand, "w") {|f|
  f.puts "$ok = 1"
}

require path

assert_equal(1, $ok)
File.unlink(expand)

puts :ok
}}}

Modified Paths:
--------------
    MacRuby/trunk/load.c

Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c	2010-12-17 09:20:42 UTC (rev 5045)
+++ MacRuby/trunk/load.c	2010-12-17 13:11:17 UTC (rev 5046)
@@ -233,7 +233,7 @@
 search_required(VALUE name, VALUE *out, int *type)
 {
     const char *name_cstr = RSTRING_PTR(name);
-    if (*name_cstr == '/' || *name_cstr == '.') {
+    if (*name_cstr == '/' || *name_cstr == '.' || *name_cstr == '~') {
 	// Given name is an absolute path.
 	name = rb_file_expand_path(name, Qnil);
 	return check_path(RSTRING_PTR(name), out, type);	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101217/06f88e91/attachment.html>


More information about the macruby-changes mailing list