Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created September 23, 2011 13:06
Show Gist options
  • Select an option

  • Save pasberth/1237286 to your computer and use it in GitHub Desktop.

Select an option

Save pasberth/1237286 to your computer and use it in GitHub Desktop.
とりあえず書いてみた
# あらゆる 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