diff --git a/NEWS b/NEWS index e8fdfe0cf5..aadb1224c9 100644 --- a/NEWS +++ b/NEWS @@ -194,8 +194,8 @@ Fiber:: File:: Modified method:: - * File.extname now returns a dot string at a name ending with a - dot. [Bug #15267] + * File.extname now returns a dot string at a name ending with a dot on + non-Windows platforms. [Bug #15267] File.extname("foo.") #=> "." diff --git a/file.c b/file.c index d10aeaa3e0..17881c065d 100644 --- a/file.c +++ b/file.c @@ -4789,10 +4789,13 @@ ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc) * An empty string will also be returned when the period is the last character * in +path+. * + * On Windows, trailing dots are truncated. + * * File.extname("test.rb") #=> ".rb" * File.extname("a/b/d/test.rb") #=> ".rb" * File.extname(".a/b/d/test.rb") #=> ".rb" - * File.extname("foo.") #=> "." + * File.extname("foo.") #=> "" on Windows + * File.extname("foo.") #=> "." on non-Windows * File.extname("test") #=> "" * File.extname(".profile") #=> "" * File.extname(".profile.sh") #=> ".sh"