Zip a file with a path size superior to MAX_PATH
Describe the Bug I can't zip a file with a path superior to the Windows path limit (260 characters).
Expected Behavior I should be able to zip the file
Observed Behavior zip_source_file returns NULL because it uses GetFileAttributesExW this function has a path size limit.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function (GetFileAttributesExW), and prepend "\?" to the path. For more information, see Naming a File.
libzip Version 1.8.2
Operating System Windows only
We have no expertise on Windows. Do you have a patch suggestion?
The win32w backend already uses the recommended workaround (GetFileAttributesExW) so I suggest you use that - i.e. zip_source_win32w() or zip_source_win32w_create().
Here is some related code: https://github.com/dart-lang/sdk/blob/46bc947e75ca3ad2004e835e2b2698b61aab102f/runtime/bin/file_win.cc#L468-L469 https://github.com/openjdk/jdk/blob/e80b5ea448c715519d14e238321ceb5ec40b37f4/src/hotspot/os/windows/os_windows.cpp#L4440
I have never programmed for Windows though.