iquercorb / OpenModMan

Open Mod Manager - Open source and generic Mod ("Modifications") manager.
GNU General Public License v3.0
91 stars 5 forks source link

Long file names in package cause PATH_NOT_FOUND error #52

Closed fashionableDark closed 1 year ago

fashionableDark commented 1 year ago

https://github.com/sedenion/OpenModMan/assets/145222067/c3f3c929-5bee-46c7-8e12-e54b32bc2217

Also, trying to convert it to a zipped package with with the package editor causes a similar error on the same file: image

EDIT: I now realize it's the long file name or path that causes this. textures\flatlist\_win\cave_k_map02_rep_ovl_alp_mod1110_emap.bmp_3baab6ec77302c0a65bcd9e3edeaaf97.ctxr

iquercorb commented 1 year ago

I suspect the problem come from elsewhere, there is no fixed size buffer and path length is theoretically not limited. Can you try to rename the file to reduce the path length to a length equal to another file (that do not throw error) and see if the error persist ?

fashionableDark commented 1 year ago

Once the file name is shortened, there is no error. Perhaps this could be solved by adding ws2:longPathAware to the manifest as mentioned here (at the bottom)? And yes, my machine has had the LongPathsEnabled registry value set already.

EDIT: This is also relevant.. Probably worth prefixing \\?\ so it works for people who don't have the registry tweak.

iquercorb commented 1 year ago

The "ws2:longPathAware" does the trick, for FileCopyW() at least... Interestingly, even with LongPathsEnabled register key, on my system (Win 10 22h2) the file explorer refuses to create file or folder if the resulting path exceed the historical limit.

It seam that if the old MAX_PATH limitation is officially over, it still valid in many context and support for path longer than 260 char still marginal and not fully supported yet even by Windows itself.

I recommand you to keep file tree with path bellow 260 chars as most as possible since I'm not sure that everything work as expected, I specially need to test the Zip file interface, but I'am precisely currently rewrite it using anther library...

fashionableDark commented 1 year ago

Thank you 👍

Yes, my modding hub is per-game and located in the game's directory (I want all files related to one game to be in one directory), so the path quickly becomes quite long.