Created
September 23, 2011 13:06
-
-
Save pasberth/1237286 to your computer and use it in GitHub Desktop.
とりあえず書いてみた
This file contains hidden or 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
| # あらゆる 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment