I could be wrong in my understanding about these prefixes!
But what I have observed is that fs::create_directories() with a long UNC path succeeds only if it has \\?\UNC\ prefix and not \\?\.
For a mapped network drive e.g. S:\...long path..., the regular prefix works i.e. \\?\
bit7z v4.0.8, Win10, Visual Studio 2022 v17.11.2, C++17, x64
BitArchiveReader.extractTo()
fails if theoutDir
is a very long UNC path e.g. 635 chars long.The
failedFiles()
indicate that the file has a prefix\\?\
I presume this could be the cause of failure as this prefix seems to be designated for local drives only.
I suppose bit7z should apply the long-path-prefix designated for the UNC paths i.e.
\\?\UNC\
as described here:https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
I could be wrong in my understanding about these prefixes!
But what I have observed is that
fs::create_directories()
with a long UNC path succeeds only if it has\\?\UNC\
prefix and not\\?\
.For a mapped network drive e.g.
S:\...long path...
, the regular prefix works i.e.\\?\
I use Win32
shlwapi.h
->PathIsUNC()
to determine which prefix to apply.https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisuncw
Here is my sample code for your reference:
Thanks for your support! 🙏