fix previous change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
31fd8aa681
commit
6e41de6767
@ -111,6 +111,8 @@ class Pathname
|
|||||||
# it may return relative pathname.
|
# it may return relative pathname.
|
||||||
# Otherwise it returns absolute pathname.
|
# Otherwise it returns absolute pathname.
|
||||||
def realpath(force_absolute=true)
|
def realpath(force_absolute=true)
|
||||||
|
File.stat(@path)
|
||||||
|
|
||||||
top = %r{\A/} =~ @path ? '/' : ''
|
top = %r{\A/} =~ @path ? '/' : ''
|
||||||
unresolved = @path.scan(%r{[^/]+})
|
unresolved = @path.scan(%r{[^/]+})
|
||||||
resolved = []
|
resolved = []
|
||||||
@ -123,7 +125,7 @@ class Pathname
|
|||||||
resolved.unshift unresolved.pop
|
resolved.unshift unresolved.pop
|
||||||
else
|
else
|
||||||
path = top + unresolved.join('/')
|
path = top + unresolved.join('/')
|
||||||
if File.lstat(path).symlink?
|
if FileTest.symlink? path
|
||||||
link = File.readlink(path)
|
link = File.readlink(path)
|
||||||
if %r{\A/} =~ link
|
if %r{\A/} =~ link
|
||||||
top = '/'
|
top = '/'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user