Feature #7412

Pathname#relative_path_from does not support mixed directory separators on windows

Added by Syver Enstad over 1 year ago. Updated 3 months ago.

[ruby-core:49666]
Status:Assigned
Priority:Normal
Assignee:Akira Tanaka
Category:lib
Target version:current: 2.2.0

Description

=begin
The support for mixing backslashes and forward slashes in the pathname module in the standard library seems to be broken on windows

require 'pathname'
base = Pathname.new("c:\\")
filepath = Pathname.new("c:/foo/bar/file.ext")
base.relative_path_from(filepath)

raises ArgumentError: different prefix: "c:\\" and "c:/foo/bar/file.ext"

Changing filepath to contain backslashes fixes the problem

filepath = Pathname.new("c:\\foo\\bar\\file.ext")
base.relative_path_from(filepath)

=> #<Pathname:../../..>
=end

History

#1 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Akira Tanaka
  • Target version set to 2.0.0

#2 Updated by Yusuke Endoh about 1 year ago

  • Tracker changed from Bug to Feature

Looks a feature request.

Yusuke Endoh mame@tsg.ne.jp

#3 Updated by Koichi Sasada about 1 year ago

ping -> akr

#4 Updated by Koichi Sasada about 1 year ago

  • Target version changed from 2.0.0 to 2.1.0

#5 Updated by Hiroshi SHIBATA 3 months ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF