mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
merge revision(s) 7a05dbc47831a655a1ef8a1635f88292acd325da: [Backport #21561]
File.dirname: return consistent encoding for `"."` [Bug #21561] It's preferable if the method is consistent in the encoding in the returned string.
This commit is contained in:
parent
00fa53d0ba
commit
21709a5868
7
file.c
7
file.c
@ -4947,8 +4947,11 @@ rb_file_dirname_n(VALUE fname, int n)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (p == name)
|
||||
return rb_usascii_str_new2(".");
|
||||
if (p == name) {
|
||||
dirname = rb_str_new(".", 1);
|
||||
rb_enc_copy(dirname, fname);
|
||||
return dirname;
|
||||
}
|
||||
#ifdef DOSISH_DRIVE_LETTER
|
||||
if (has_drive_letter(name) && isdirsep(*(name + 2))) {
|
||||
const char *top = skiproot(name + 2, end, enc);
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 5
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 53
|
||||
#define RUBY_PATCHLEVEL 54
|
||||
|
||||
#include "ruby/version.h"
|
||||
#include "ruby/internal/abi.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user