Skip to content
Browse files

Raise LoadError when the script does not have data_path

  • Loading branch information...
1 parent 300ad87 commit ae997dd65b7fb33e734d73e37ab0b2bdc349a2e2 @LTe committed Jul 5, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 kernel/common/codeloader19.rb
4 kernel/common/codeloader19.rb
@@ -22,7 +22,9 @@ def search_load_path(name, loading)
# check to make sure it's not called inside of an eval.
def self.require_relative(name, scope)
script = scope.current_script
- if script
+ if script && script.data_path.nil?
+ raise "cannot infer basepath from #{script.file_path}"
+ elsif script
require File.expand_path(name, File.dirname(script.data_path))
raise "Something is wrong in trying to get relative path"

0 comments on commit ae997dd

Please sign in to comment.
Something went wrong with that request. Please try again.