On Mar 28 22:31, LIU Hao wrote:
> 在 2023-03-28 21:41, Corinna Vinschen 写道:
> > Either you allow to split the *entire* share path, so you can use
> > dirname/basename to split \\host\share into the host and the share path,
> > and also to split \\ and host.  That would allow to inspect the host and
> > share components using the same functions.
> 
> No, this would allow splitting `\\host\\share` as `host` and `share`. In
> this path the share name is `\share`, and does not match `share`.

Backslahs is one of the characters not allowed as part of a share
name, just as it is not allowed as part of a filename.  I. e.

  \\host\share is ok
  \\host\\share can't exist

> > Or you value the fact that the resulting path is still valid higher,
> > then you have to stop dirname at \\host\share and never split these
> > paths.
> > 
> > One problem you have with the latter approach is this: What do you do
> > with input paths of the form "\\host"?  In other words, what do you
> > return if the input is invalid?  In theory it should stay unchanged,
> > so dirname should just return the invalid path verbatim.
> 
> The current algorithm has a concept about 'volume prefix'. This path is
> taking as a sole prefix and an empty component, and is absolute. Hence,
> `dirname()` returns the prefix with a backslash appended i.e. `\\host\`, and
> `basename()` returns `\`.

Hmm, ok.  But \\host\ is just as invalid as \\host...


Corinna


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to