-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from BetterErrors/fix/load-extension-from-ext-dir
Load extension from ext directory when it's not in lib
- Loading branch information
Showing
2 changed files
with
35 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
require 'rbconfig' | ||
dlext = RbConfig::CONFIG['DLEXT'] | ||
begin | ||
require_relative "debug_inspector.#{dlext}" | ||
# If the above require fails, we don't want to define any constants. | ||
# If the installation task did its job, the extension is in lib/ next to this file. | ||
require "debug_inspector.#{dlext}" | ||
# We only want to define constants if the extension has loaded. | ||
require_relative "rubyvm/debug_inspector/version" | ||
rescue LoadError | ||
begin | ||
# If not, maybe the extension is in ext/ | ||
require_relative "../ext/debug_inspector/debug_inspector.#{dlext}" | ||
# We only want to define constants if the extension has loaded. | ||
require_relative "rubyvm/debug_inspector/version" | ||
rescue LoadError => e | ||
puts "debug_inspector extension was not loaded" | ||
end | ||
end |