Forum: Ruby-core [ruby-trunk - Bug #7412][Open] Pathname#relative_path_from does not support mixed directory separato

Posted by 7er (Syver Enstad) (Guest)
on 2012-11-20 12:16
(Received via mailing list)
Issue #7412 has been reported by 7er (Syver Enstad).

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

Author: 7er (Syver Enstad)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
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
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-24 09:44
(Received via mailing list)
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
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-24 13:23
(Received via mailing list)
Issue #7412 has been updated by ko1 (Koichi Sasada).


ping -> akr
----------------------------------------
Feature #7412: Pathname#relative_path_from does not support mixed 
directory separators on windows
https://bugs.ruby-lang.org/issues/7412#change-36908

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


=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
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-24 13:47
(Received via mailing list)
Issue #7412 has been updated by ko1 (Koichi Sasada).

Target version changed from 2.0.0 to 2.1.0


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

Author: 7er (Syver Enstad)
Status: Assigned
Priority: Normal
Assignee: akr (Akira Tanaka)
Category: lib
Target version: 2.1.0


=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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.