mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fallback if Pathname#relative_path_from fails
It can fail due to different prefixes, e.g., drive letters or UNC paths on DOSish platform.
This commit is contained in:
parent
df275179bd
commit
ec03d13742
2 changed files with 4 additions and 2 deletions
|
@ -20,7 +20,8 @@ class RubyVM::Scanner
|
|||
attr_reader :__LINE__
|
||||
|
||||
def initialize path
|
||||
src = Pathname.new(__FILE__).relative_path_from(Pathname.pwd).dirname
|
||||
src = Pathname.new(__FILE__)
|
||||
src = (src.relative_path_from(Pathname.pwd) rescue src).dirname
|
||||
src += path
|
||||
@__LINE__ = 1
|
||||
@__FILE__ = src.to_path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue