标准库中路径名模块中混合反斜杠和正斜杠的支持似乎在Windows上被破坏
require 'pathname'
base = Pathname.new("c:\\")
filepath = Pathname.new("c:/foo/bar/file.ext")
base.relative_path_from(filepath)
提出ArgumentError: different prefix: "c:\\" and "c:/foo/bar/file.ext"
更改文件路径以包含反斜杠可以解决问题
filepath = Pathname.new("c:\\foo\\bar\\file.ext")
base.relative_path_from(filepath)
=> #<Pathname:../../..>