Closed smilediver closed 7 years ago
That is an interesting question. I can see how it's a bit unexpected.
I didn't make the change so I can't speak to the reasoning behind why the behavior was changed. One perspective I can see is that an NPath should always represent a path. An empty string is not a path, it's simply an empty string.
Allowing a NPath to be an empty string would create a niche state that a NPath could be in. I'm not sure what you would even do with a NPath who's ToString() value was an empty string. It feels like that would just "force" error checking onto the user of the API because trying to use an empty string path is not going to work out well.
Currently
new NPath("").ToString()
returns"."
. I think the result should be an empty string, because "an empty path, or relative to anything" and "path relative to current directory" have quite different semantic meanings. But I'm not 100% convinced myself. What do you think? This was introduced in 62deffd.