ftools.rb
···
#########
def move from, to, verbose = false
to = catname(from, to)
$deferr.print from, " -> ", to, “\n” if verbose
if RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/ and FileTest.file? to
unlink to
end
fstat = stat(from)
begin
rename from, to
rescue
begin
symlink File.readlink(from), to and unlink from
rescue
from_stat = stat(from)
syscopy from, to and unlink from
utime(from_stat.atime, from_stat.mtime, to)
begin
chown(fstat.uid, fstat.gid, to)
rescue
end
end
end
end
If the rename call fails for something like “Permission denied” – then
the rescue clause tries to do a .readlink which is not supported on
Windows. Ruby raises that error, and the original exception is hidden.
I’m guessing a fix would be to do a platform regex like earlier in the
method and not attempt the link related items if on Windows, etc.
Workaround is just to use File.rename instead.
–
Chris
http://clabs.org/blogki