Commit b5946822 authored by KOBAYASHI Shuji's avatar KOBAYASHI Shuji

Defer getting `caller_dir` until needed in `MRuby::LoadGems#gem`

parent cc54257d
...@@ -13,13 +13,12 @@ module MRuby ...@@ -13,13 +13,12 @@ module MRuby
end end
def gem(gemdir, &block) def gem(gemdir, &block)
caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
if gemdir.is_a?(Hash) if gemdir.is_a?(Hash)
gemdir = load_special_path_gem(gemdir) gemdir = load_special_path_gem(gemdir)
elsif GemBox.path && gemdir.is_a?(String) elsif GemBox.path && gemdir.is_a?(String)
gemdir = File.expand_path(gemdir, File.dirname(GemBox.path)) gemdir = File.expand_path(gemdir, File.dirname(GemBox.path))
else else
caller_dir = File.expand_path(File.dirname(caller(1,1)[0][/^(.*?):\d/,1]))
gemdir = File.expand_path(gemdir, caller_dir) gemdir = File.expand_path(gemdir, caller_dir)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment