From d03fb9d1c65250f51c7c6e79a80dbd80ddf62a9f Mon Sep 17 00:00:00 2001 From: rofinn Date: Mon, 27 Apr 2020 16:39:45 -0500 Subject: [PATCH] Make print and show consistent for WindowsPath. --- src/windows.jl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/windows.jl b/src/windows.jl index e0da293..459ba1d 100644 --- a/src/windows.jl +++ b/src/windows.jl @@ -74,13 +74,12 @@ function Base.:(==)(a::WindowsPath, b::WindowsPath) lowercase(a.drive) == lowercase(b.drive) end +function Base.print(io::IO, fp::WindowsPath) + print(io, replace(fp.anchor, "\\" => "/") * join(fp.segments, "/")) +end + function Base.show(io::IO, fp::WindowsPath) - print(io, "p\"") - if isabsolute(fp) - print(io, replace(fp.anchor, "\\" => "/")) - end - print(io, join(fp.segments, "/")) - print(io, "\"") + print(io, "p\"" * replace(fp.anchor, "\\" => "/") * join(fp.segments, "/") * "\"") end isabsolute(fp::WindowsPath) = (!isempty(fp.drive) || !isempty(fp.root))