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
{{ message }}
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
Specifying Path.LocalToUnc("W:\\subpath", false, true, false) returns \\server\share\subpath (if W: maps to \server\share) without adding the trailing directory separator. The inverse is also happening, if a separator is included at the end of a mapped drive path with the call to remove it: Path.LocalToUnc("W:\\subpath\\", false, false, true) returns \\server\share\subpath\.
These parameters do seem to work with actual local paths (non-mapped local drives).
This behavior is occurring in 2.1.3 as well as the develop branch as of commit 2437105.
On a tangential note, would it be better served having the signature for Path.LocalToUnc(string, bool, bool, bool) replaced with a signature such as Path.LocalToUnc(string, bool, DirectorySeparatorHandling) where DirectorySeparatorHandling could be an enum such as:
I ask this simply because it is non-determinate from just reading the code what the output would be when both trailing separator booleans are set to true, without actually running the code. Essentially, it looks like I can set two mutually exclusive options at the same time. Right now, when both are set to true, it looks like the "remove trailing separator" logic wins out. Just a thought. :-)
The text was updated successfully, but these errors were encountered:
damiarnold
changed the title
Path.ToLocalUnc() isn't handling trailing directory separators for mapped drives
Path.LocalToUnc() isn't handling trailing directory separators for mapped drives
Jan 9, 2018
Specifying
Path.LocalToUnc("W:\\subpath", false, true, false)
returns\\server\share\subpath
(if W: maps to \server\share) without adding the trailing directory separator. The inverse is also happening, if a separator is included at the end of a mapped drive path with the call to remove it:Path.LocalToUnc("W:\\subpath\\", false, false, true)
returns\\server\share\subpath\
.These parameters do seem to work with actual local paths (non-mapped local drives).
This behavior is occurring in 2.1.3 as well as the
develop
branch as of commit 2437105.On a tangential note, would it be better served having the signature for
Path.LocalToUnc(string, bool, bool, bool)
replaced with a signature such asPath.LocalToUnc(string, bool, DirectorySeparatorHandling)
whereDirectorySeparatorHandling
could be an enum such as:enum DirectorySeparatorHandling { None = 0, RemoveTrailingSeparator =1, AddTrailingSeparator = 2 }
I ask this simply because it is non-determinate from just reading the code what the output would be when both trailing separator booleans are set to true, without actually running the code. Essentially, it looks like I can set two mutually exclusive options at the same time. Right now, when both are set to true, it looks like the "remove trailing separator" logic wins out. Just a thought. :-)
The text was updated successfully, but these errors were encountered: