Project

General

Profile

Actions

Bug #12261

closed

Windows: File.dirname with 2+ / or 2+ \\ will return // or \\\\

Added by enebo (Thomas Enebo) almost 8 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
[ruby-core:74848]

Description

I am working through some File.dirname issues on JRuby and I saw a ruby/spec covering this behavior on windows:

File.dirname('/////').should == '//'

Same result if backslashes are used. Is there a reason for this result? It does not seem useful to me but I am not much of a windows user. I would think in this case it would be '/' since I don't see how this is useful for UNC paths in Ruby? If someone could explain it then I will document this at least in JRuby source code :)

So far all versions of MRI seem to have this behavior.

Actions

Also available in: Atom PDF

Like0
Like0Like0