On my test system (Windows 10 x64), the UNC PATH \\Mac\Home\Documents
is mapped to Y:\Documents
. Is there a Delphi function to generally convert a UNC Path to its corresponding mapped Drive path (if it has one)?
function ConvertUNCPathToDrivePath(const AUncPath: string): string;
This would convert \\Mac\Home\Documents
to Y:\Documents
.
AFAIK, there are no functions to convert a UNC path to a mapped-drive path.
However, there are Win32 API functions, such as WNetGetConnection()
and WNetGetUniversalName()
, which can be used to convert a mapped-drive path to its UNC path.
You can enumerate the local drive letters and see if any of them convert to the UNC you are interested in.