Skip to content

replace fails for file paths #158

@omus

Description

@omus
julia> using FilePathsBase

julia> replace(PosixPath("/a/b/c"), "b" => "c")
ERROR: MethodError: no method matching similar(::PosixPath, ::Type{String})
Closest candidates are:
  similar(::Union{LinearAlgebra.Adjoint{T, var"#s814"}, LinearAlgebra.Transpose{T, var"#s814"}} where {T, var"#s814"<:(AbstractVector{T} where T)}, ::Type{T}) where T at /Users/omus/Development/Julia/x86_64/1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:230
  similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}) where T at /Users/omus/Development/Julia/x86_64/1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:234
  similar(::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}, ::Type{T}, ::Tuple{Vararg{Int64, N}}) where {T, N} at /Users/omus/Development/Julia/x86_64/1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:235
  ...
Stacktrace:
 [1] _similar_or_copy(x::PosixPath, #unused#::Type{String})
   @ Base ./set.jl:444
 [2] replace(A::PosixPath, old_new::Pair{String, String}; count::Nothing)
   @ Base ./set.jl:559
 [3] replace(A::PosixPath, old_new::Pair{String, String})
   @ Base ./set.jl:556
 [4] top-level scope
   @ REPL[6]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions