From: Alex Young Date: 2011-03-16T05:29:26+09:00 Subject: Proposal: require to return path to loaded file If you're doing anything at all involved with $LOAD_PATH, it can be a right pain trying to track down which file was actually loaded. It would *really* help debugging if require returned the full path to the file. Would this break anything? Alternatively, is there any other way to get at this information? While I admit that I haven't exactly tested it extensively, it's about as simple a patch as you can get. In 1.8.7-p302, it's: diff --git a/eval.c b/eval.c index 7156c06..ca4d99b 100644 --- a/eval.c +++ b/eval.c @@ -7455,7 +7455,7 @@ rb_require_safe(fname, safe) break; } rb_provide_feature(feature); - result = Qtrue; + result = path; } } } Running this gives (obviously): $ ruby -e 'p require "socket"' "/home/alex/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/i686-linux/socket.so" From a cursory inspection, it looks like the same idea ought to apply to load.c in 1.9.2. Thoughts, anyone? Given that it's this simple and I can't be the first person to have thought of it, is there a reason it's the way it is? -- Alex -- Posted via http://www.ruby-forum.com/.