diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-04-09 18:04:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-04-09 18:04:08 +0000 |
commit | 32e799db485107ba9d47fb4fb4cd44c9d6f57b8a (patch) | |
tree | e33fd45f76d7f31959c1e5298902588de716657c /lib/ftools.rb | |
parent | 35247a52ef719584a59ae9c518523f0ee825c8e3 (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ftools.rb')
-rw-r--r-- | lib/ftools.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ftools.rb b/lib/ftools.rb index 103e27adbd..7bba07e9f1 100644 --- a/lib/ftools.rb +++ b/lib/ftools.rb @@ -24,6 +24,9 @@ class << File fsize = 1024 if fsize < 512 fsize = TOO_BIG if fsize > TOO_BIG + fmode = stat(from).mode + tpath = to + from = open(from, "r") from.binmode to = open(to, "w") @@ -47,6 +50,7 @@ class << File to.close from.close end + chmod(fmode, tpath) ret end @@ -66,10 +70,17 @@ class << File if PLATFORM =~ /djgpp|cygwin|mswin32/ and FileTest.file? to unlink to end + fstat = stat(from) begin rename from, to 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, tpath) + rescue + end end end |