Issue #7412 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to akr (Akira Tanaka)
Target version set to 2.0.0


----------------------------------------
Bug #7412: Pathname#relative_path_from does not support mixed directory separators on windows
https://bugs.ruby-lang.org/issues/7412#change-33801

Author: 7er (Syver Enstad)
Status: Assigned
Priority: Normal
Assignee: akr (Akira Tanaka)
Category: lib
Target version: 2.0.0
ruby -v: 1.9.3


=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



-- 
http://bugs.ruby-lang.org/