You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect the following where splitting a single length dir yields a 1 length list not a list with an empty string first- is this a bug or a feature? If it is a feature could someone explain why
I believe it's intentional. It's an edge case and in that case you can't join back with join, why you need/should always use joinpath. It takes this edge case into account. For that reason, I feel like the docs of both can be improved, with See also, pointing to ch other. Feel free to make a doc PR.
[The one-param _splitdir_nodrive(path::String) is defined [see below] but never used.]
A bit more surprising was (on my non-Windows, until I realized only option there, and you should not get that on Windows):
julia> splitdrive("C:\file")
("", "C:\file")
function splitdir(path::String)
a, b = splitdrive(path)
_splitdir_nodrive(a,b)
end
# Common splitdir functionality without splitdrive, needed for splitpath.
_splitdir_nodrive(path::String) = _splitdir_nodrive("", path)
function _splitdir_nodrive(a::String, b::String)
splitdrive(path::String) = ("",path)
elseif Sys.iswindows()
..
function splitdrive(path::String)
m = match(r"^([^\\]+:|\\\\[^\\]+\\[^\\]+|\\\\\?\\UNC\\[^\\]+\\[^\\]+|\\\\\?\\[^\\]+:|)(.*)$"sa, path)::AbstractMatch
String(something(m.captures[1])), String(something(m.captures[2]))
end
This may be intended behaviour but I can't see why it would be- if it is pointing out why would be appreciated
The following is the observed behaviour
I would expect the following where splitting a single length dir yields a 1 length list not a list with an empty string first- is this a bug or a feature? If it is a feature could someone explain why
The text was updated successfully, but these errors were encountered: