Download

PLATFORM_MAX_FILEPATH_LENGTH and MAX_PATH during a cooked build

Hi,
I am currently experiencing a failure during the cooking on my data from CookCommandlet.cpp saying:
Couldn’t save package, filename is too long
It is true that my path is long, it is just a bit over the MAX_PATH defined in Windows at 260 characters.
However in these modern days, a long folder hierarchy shouldn’t prevent a build from working so I was trying to fix it, and I discovered that Unreal calls MoveFileW in WindowsPlatformFile.cpp, and this is where it fails.
The Windows documentation mentions that:

“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 and prepend “\?” to the path. For more information, see Naming a File.”

So basically I was wondering: if I modify NormalizeFilename() so it would always prepend “\?” to all paths, would that fix everything?
If so, would Epic prefer to do it in their codebase, or are there other dangers lurking?

Thanks!

Hey Remzpasta,

We have also been hit by this, but so far resorted to subst-ing long paths just for all assets to fit within this unreasonable MAX_PATH limitation.

Could you tell if the fix worked for you? If it did, maybe you could submit a pull request to github?

Cheers!
Ilya