Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # あらゆる require より後に定義する
- # これより前に定義されたあらゆるrequireが失敗した場合、パスの名前をwinに変えてリトライする
- module Kernel
- alias win_path_original_require require
- def require path
- win_path_original_require path
- rescue LoadError => e
- win_path_original_require to_win_path path
- end
- def to_win_path path
- win_path = path
- if path =~ /^\/(.*?)$/
- win_path = "C:\\#{$1}"
- elsif path =~ /^\.\/(.*?)$/
- win_path = "#{$1}"
- end
- win_path.gsub('/', "\\")
- end
- end
Add Comment
Please, Sign In to add comment