FileUtils.cp_r  incorrectly produces "same file" error when files to be copied 
already exist in destination directory
---------------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-1943
                 URL: http://jira.codehaus.org/browse/JRUBY-1943
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: JRuby 1.1RC1, Rails 2.0.2, Mongrel-1.1.3-java, Win XP
            Reporter: Raphael Gillett
             Fix For: JRuby 1.1


FileUtils copy routines give "same file" error when files to be copied  already 
exist in destination directory.   Amongst other problems, this error causes the 
ActiveScaffold 1.1RC1 plugin to abort when run under JRuby.   
Test case:
Place identical files in subdirectories temp1 and temp2
Create "filecopying.rb" =>
require 'fileutils'
include FileUtils
directory = File.dirname(__FILE__)
source_path = "/temp1"
destination_path ="/temp2"
source = File.join(directory, source_path)
destination = File.join(directory, destination_path)
FileUtils.cp_r(Dir.glob(source+'/*.*'), destination, :verbose => true)

Running "jruby filecopying.rb" triggers "same file" error.    
Under MRI ("ruby filecopying.rb") the pre-existing files in temp2 are 
overwritten and no error message is given.

Patch:   fileutils.rb
Replace lines
    def fu_windows?
      /mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
    end
with
    def fu_windows?
      /mswin|mingw|bccwin|wince|emx|java/ =~ RUBY_PLATFORM
    end

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to