mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/pathname.rb (Pathname#unlink): try Dir.unlink first to
avoid unlink a directory by root. cf. [ruby-dev:26237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2e820ca5e0
commit
f41e9c805c
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sun Jul 10 23:58:04 2005 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* lib/pathname.rb (Pathname#unlink): try Dir.unlink first to
|
||||||
|
avoid unlink a directory by root.
|
||||||
|
cf. [ruby-dev:26237]
|
||||||
|
|
||||||
Sun Jul 10 12:47:01 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jul 10 12:47:01 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/debug.rb (debug_command): added a deficient format specifier.
|
* lib/debug.rb (debug_command): added a deficient format specifier.
|
||||||
|
|
|
@ -869,9 +869,9 @@ class Pathname # * mixed *
|
||||||
# <tt>Dir.unlink</tt> as necessary.
|
# <tt>Dir.unlink</tt> as necessary.
|
||||||
def unlink()
|
def unlink()
|
||||||
begin
|
begin
|
||||||
File.unlink @path
|
|
||||||
rescue SystemCallError
|
|
||||||
Dir.unlink @path
|
Dir.unlink @path
|
||||||
|
rescue Errno::ENOTDIR
|
||||||
|
File.unlink @path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias delete unlink
|
alias delete unlink
|
||||||
|
|
Loading…
Reference in a new issue