Description

If the file path with the asset contains a project name, the cooking file pathlength is incorrectly increased.

The following code in ContentBrowserUtils :: GetPackageLengthForCooking causes this issue.

// Pad out the game name to the maximum allowed
const FString GameName = FApp::GetProjectName();
FString GameNamePadded = GameName;
while (GameNamePadded.Len() < MaxGameNameLen)
{
GameNamePadded += TEXT(" ");
}
...
// Test that the package can be cooked based on the current project path
FString AbsoluteCookPathToAsset = AbsoluteCookPath / AssetPathWithinCookDir;
// only add game name padding if it is not an engine asset, otherwise it is considered portable already
if (!bIsEngineAsset)
{
AbsoluteCookPathToAsset.ReplaceInline(*GameName, *GameNamePadded, ESearchCase::CaseSensitive);
}
AbsoluteCookPathToAssetLength = AbsoluteCookPathToAsset.Len();

The value returned by GetPackageLengthForCooking can be very large because GameNamePadded is forced to be 20 characters and it is used by ReplaceInline. Then, in the case of windows, an error occurs with the 260-character limit
The above code is very old code, so I do not know why this implementation is such, but it should be fixed.

Steps to Reproduce
  1. Create new project named "abc" 
  2. Create BP in Content
  3. Create BP in Content/a
  4. Create BP in Content/abc
  5. Create BP in Content/abcabc
  6. Check each BP's cooking file pathlength

result : if path has project name, the pathlength is obviously wrong. Please look at the attached image.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-77024 in the post.

0
Login to Vote

Fixed
ComponentTools
Affects Versions4.22.3
Target Fix4.25
Fix Commit10374103
Main Commit11224363
CreatedJul 10, 2019
ResolvedNov 22, 2019
UpdatedAug 10, 2021