From: John Date: 2008-04-26T04:50:06+09:00 Subject: Re: in FileUtils.cp_r *not* replacing read-only files On Apr 25, 9:41 am, cb wrote: > Hi everyone, > > I'm porting some ruby code from MacOS to Windows XP. The code works fine on the > Mac, but not on Windows as you can see. > > This is the code that's causing the error (line 278 of buildwebclient.rb): > > FileUtils.cp_r("#{$html_template_path}/.", "#{$build_destination_path}", :preserve => true, :verbose=> true, :remove_destination => true) > > Please note: The reason I use the remove_destination option is because the source > and target files are read-only. This behaves as I would expect on the Mac. > > The is the log of the error: > > cp -rp --remove-destination C:\Projects/rnd/WebClient/RELEASE/Source/MindjetConnect/html-template/. C:\Projects/rnd/WebClient/RELEASE/BuiltVersions/WebClient_1.0.74 > An exception caused the build script to fail: > Permission denied - C:\Projects/rnd/WebClient/RELEASE/BuiltVersions/WebClient_1.0.74/. > c:/ruby/lib/ruby/1.8/fileutils.rb:1270:in `utime' > c:/ruby/lib/ruby/1.8/fileutils.rb:1270:in `copy_metadata' > c:/ruby/lib/ruby/1.8/fileutils.rb:452:in `copy_entry' > c:/ruby/lib/ruby/1.8/fileutils.rb:1324:in `traverse' > c:/ruby/lib/ruby/1.8/fileutils.rb:448:in `copy_entry' > c:/ruby/lib/ruby/1.8/fileutils.rb:423:in `cp_r' > c:/ruby/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest' > c:/ruby/lib/ruby/1.8/fileutils.rb:1409:in `fu_each_src_dest0' > c:/ruby/lib/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest' > c:/ruby/lib/ruby/1.8/fileutils.rb:422:in `cp_r' > buildwebclient.rb:278 > > The version of ruby on XP is: > > ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mswin32] > > On the Mac, it's: > > ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0] > > I would use FileUtils.cp :force but that means I'd have to know every single file and > directory that I'm copying -- I don't want to have to maintain such a list. > > Any ideas? Known issue? > > Thanks. > > CB Could it be the C:\.../.../ sillyness?