зеркало из https://github.com/github/ruby.git
* file.c (rb_file_dirname): split from rb_file_s_dirname.
* load.c (rb_f_require_relative): use absolute path instead of expanded path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
635bdf6f13
Коммит
38af94c6ab
|
@ -1,3 +1,10 @@
|
|||
Tue Mar 30 18:25:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rb_file_dirname): split from rb_file_s_dirname.
|
||||
|
||||
* load.c (rb_f_require_relative): use absolute path instead of
|
||||
expanded path.
|
||||
|
||||
Tue Mar 30 13:57:08 2010 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* process.c (proc_daemon): Process.daemon should raise an error on
|
||||
|
|
8
file.c
8
file.c
|
@ -3428,8 +3428,14 @@ rb_file_s_basename(int argc, VALUE *argv)
|
|||
* File.dirname("/home/gumby/work/ruby.rb") #=> "/home/gumby/work"
|
||||
*/
|
||||
|
||||
VALUE
|
||||
static VALUE
|
||||
rb_file_s_dirname(VALUE klass, VALUE fname)
|
||||
{
|
||||
return rb_file_dirname(fname);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_file_dirname(VALUE fname)
|
||||
{
|
||||
const char *name, *root, *p;
|
||||
VALUE dirname;
|
||||
|
|
|
@ -355,6 +355,7 @@ VALUE rb_file_s_expand_path(int, VALUE *);
|
|||
VALUE rb_file_expand_path(VALUE, VALUE);
|
||||
VALUE rb_file_s_absolute_path(int, VALUE *);
|
||||
VALUE rb_file_absolute_path(VALUE, VALUE);
|
||||
VALUE rb_file_dirname(VALUE fname);
|
||||
void rb_file_const(const char*, VALUE);
|
||||
int rb_file_load_ok(const char *);
|
||||
int rb_find_file_ext_safe(VALUE*, const char* const*, int);
|
||||
|
|
5
load.c
5
load.c
|
@ -452,13 +452,12 @@ VALUE
|
|||
rb_f_require_relative(VALUE obj, VALUE fname)
|
||||
{
|
||||
VALUE rb_current_realfilepath(void);
|
||||
VALUE rb_file_s_dirname(VALUE klass, VALUE fname);
|
||||
VALUE base = rb_current_realfilepath();
|
||||
if (NIL_P(base)) {
|
||||
rb_raise(rb_eLoadError, "cannot infer basepath");
|
||||
}
|
||||
base = rb_file_s_dirname(rb_cFile, base);
|
||||
return rb_require_safe(rb_file_expand_path(fname, base), rb_safe_level());
|
||||
base = rb_file_dirname(base);
|
||||
return rb_require_safe(rb_file_absolute_path(fname, base), rb_safe_level());
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Загрузка…
Ссылка в новой задаче