071014 windows下JRuby 1.0.2 与rails1.2.5出错的处理

在netbeans 6 ruby ide beta里面,如果使用jruby 1.0.2 并且rails升级到1.2.5,就会出错如:
C:/jruby/jruby-1.0.1/lib/ruby/1.8/pathname.rb:420:in `realpath_rec': No such file or directory - C:/railstest/C: (Errno::ENOENT)
....

避免的办法可以重新装netbeans 6 ruby ide并使用rails1.2.3

或者是在此处下载一个patch,
http://jira.codehaus.org/browse/JRUBY-1401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

patch的使用方法就是按照patch里面的说明来对pathname.rb原文件修改:

Index: pathname.rb

===================================================================

--- pathname.rb (revision 4471)

+++ pathname.rb (working copy)

@@ -285,6 +285,8 @@

   def prepend_prefix(prefix, relpath)
     if relpath.empty?
       File.dirname(prefix)
+    elsif prefix =~ /^[a-zA-Z]:$/
+      File.join(prefix,relpath)
     elsif /#{SEPARATOR_PAT}/ =~ prefix
       prefix = File.dirname(prefix)
       prefix = File.join(prefix, "") if File.basename(prefix + 'a') != 'a'
@@ -408,6 +410,8 @@

         next
       elsif n == '..'
         resolved.pop
+      elsif n =~ /^[a-zA-Z]:$/
+        resolved << n
       else
         path = prepend_prefix(prefix, File.join(*(resolved + [n])))
         if h.include? path
@@ -446,7 +450,9 @@

   def realpath
     path = @path
     prefix, names = split_names(path)
-    if prefix == ''
+    if prefix == '' && names[0] =~ /^[a-zA-Z]:$/
+      prefix = names.shift
+    elsif prefix == ''
       prefix, names2 = split_names(Dir.pwd)
       names = names2 + names
     end

很直观,+就表示加多的内容,-就是表示减少的内容

你可能感兴趣的:(windows,Ruby,Rails,Netbeans,jruby)