Project

General

Profile

Feature #7412

Pathname#relative_path_from does not support mixed directory separators on windows

Added by Syver Enstad almost 4 years ago. Updated over 2 years ago.

Status:
Assigned
Priority:
Normal
Assignee:
[ruby-core:49666]

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 [ruby-core:50027] Updated by Yusuke Endoh almost 4 years ago

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

#2 Updated by Yusuke Endoh over 3 years ago

  • Tracker changed from Bug to Feature

Looks a feature request.

--
Yusuke Endoh mame@tsg.ne.jp

#3 [ruby-core:52805] Updated by Koichi Sasada over 3 years ago

ping -> akr

#4 [ruby-core:52806] Updated by Koichi Sasada over 3 years ago

  • Target version changed from 2.0.0 to 2.1.0

#5 [ruby-core:60269] Updated by Hiroshi SHIBATA over 2 years ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF