Path too long during stage (DLC)

I’m getting path too long problems while staging (using RunUAT).

Even with the project moved down to d:\Projects\ProjectName its still going over the limit:

Project.RunUnrealPak: Running UnrealPak *******
CommandUtils.Run: Run: C:\Program Files (x86)\Epic Games\4.10\Engine\Binaries\Win64\UnrealPak.exe D:\Projects\UE4Cooker\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\UE4Cooker\Content\Paks\UE4Cooker-WindowsNoEditor.pak -create="C:\Program Files (x86)\Epic Games\4.10\Engine\Programs\AutomationTool\Saved\Logs\PakList_UE4Cooker-WindowsNoEditor.txt" -order=D:\Projects\UE4Cooker\Build\WindowsNoEditor\FileOpenOrder\CookerOpenOrder.log -UTF8Output
UnrealPak: LogPakFile:Display: Loading response file C:\Program Files (x86)\Epic Games\4.10\Engine\Programs\AutomationTool\Saved\Logs\PakList_UE4Cooker-WindowsNoEditor.txt
UnrealPak: LogPakFile:Display: Added 2 entries to add to pak file.
UnrealPak: LogPakFile:Display: Loading pak order file D:\Projects\UE4Cooker\Build\WindowsNoEditor\FileOpenOrder\CookerOpenOrder.log...
UnrealPak: LogPakFile:Display: Finished loading pak order file D:\Projects\UE4Cooker\Build\WindowsNoEditor\FileOpenOrder\CookerOpenOrder.log.
UnrealPak: LogPakFile:Display: Collecting files to add to pak file...
UnrealPak: LogPakFile:Display: Collected 2 files in 0.00s.
LogTemp: UnrealPak: LogPakFile:Display: Added 2 files, 83148 bytes total, time 0.01s.
CommandUtils.Run: Run: Took 0.2377557s to run UnrealPak.exe, ExitCode=0
Project.CreatePak: UnrealPak Done *******
BuildCommand.Execute: ERROR: BUILD FAILED
Program.Main: ERROR: AutomationTool terminated with exception:
Program.Main: ERROR: Exception in mscorlib: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Stacktrace:    at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetDirectoryName(String path)
   at AutomationTool.CommandUtils.CopyFileIncremental(String Source, String Dest, Boolean bAllowDifferingTimestamps, Boolean bFilterSpecialLinesFromIniFiles)
   at Project.CopyManifestFilesToStageDir(Dictionary`2 Mapping, String StageDir, String ManifestName, List`1 CRCFiles)
   at Project.CopyUsingStagingManifest(ProjectParams Params, DeploymentContext SC)
   at Project.ApplyStagingManifest(ProjectParams Params, DeploymentContext SC)
   at Project.CopyBuildToStagingDirectory(ProjectParams Params)
   at BuildCookRun.DoBuildCookRun(ProjectParams Params)
   at BuildCommand.Execute()
   at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
   at AutomationTool.Automation.Process(String[] CommandLine)
   at AutomationTool.Program.MainProc(Object Param)
   at AutomationTool.InternalUtils.RunSingleInstance(Action`1 Main, Object Param)
   at AutomationTool.Program.Main()
ProcessManager.KillAll: Trying to kill 0 spawned processes.
Program.Main: AutomationTool exiting with ExitCode=Error_Unknown

This is the commandline causing the problem.

C:/Program Files (x86)/Epic Games/4.10/Engine/Build/BatchFiles/RunUAT.bat BuildCookRun -project=“D:/Projects/UE4Cooker/UE4Cooker.uproject” -noP4 -clientconfig=Development -serverconfig=Development -nocompile -nocompileeditor -rocket -utf8output -platform=Win64+Win64 -targetplatform=Win64 -cook -map= -unversionedcookedcontent -pak -dlcname=DLC -basedonreleaseversion=1.0 -compressed -stage -package -cmdline= -Messaging -SessionName=‘DLC’

Certainly looks like something is going a bit wild in the creation process - this folder exists on my computer - notive the repetition of “UE4Cooker\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor”.

D:\Projects\UE4Cooker\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\UE4Cooker\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\UE4Cooker\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\UE4Cooker\Plugins\DLC

This looks like a problem create when running via a process from the editor (using: FPlatformProcess). Removing the quotes around the project name stops the recursion.

I’m not sure what the proper approach to project names is. Code I’m suing follows:

FString UATCommandLine = FString::Printf(TEXT("BuildCookRun -project=%s"), *FPaths::GetProjectFilePath());
FString defaultCmds = FString::Printf(TEXT(" -noP4 -clientconfig=%s -serverconfig=%s -nocompile -nocompileeditor -rocket -utf8output -platform=Win64+Win64 -targetplatform=Win64 -cook -map= -unversionedcookedcontent -pak -dlcname=DLC -basedonreleaseversion=1.0 -compressed -stage -package -cmdline= -Messaging -SessionName='DLC'"), *build, *build);
//FString defaultCmds = FString::Printf(TEXT(" -noP4 -clientconfig=%s -serverconfig=%s -nocompile -nocompileeditor -rocket -utf8output -platform=Win64+Win64 -targetplatform=Win64 -cook -map= -unversionedcookedcontent -pak -dlcname=DLC -basedonreleaseversion=1.0 -compressed -stage -package -cmdline= -Messaging -SessionName='DLC'"), *build, *build);
UATCommandLine += defaultCmds;
// specify the path to the editor exe if necessary

// launch UAT and monitor its progress
void* ReadPipe = nullptr, *WritePipe = nullptr;
FPlatformProcess::CreatePipe(ReadPipe, WritePipe);
FString exePath = ExecutablePath / Executable;
UE_LOG(LogTemp, Log, TEXT("Starting '%s'"), *exePath);
UE_LOG(LogTemp, Log, TEXT("   commandline: %s"), *UATCommandLine)
FProcHandle ProcessHandle = FPlatformProcess::CreateProc(*exePath, *UATCommandLine, false, true, true, NULL, 0, *ExecutablePath, WritePipe);

And really I don’t want to be triggering commandline builds - I’d prefer to use the project launcher I just don’t know how to invoke it from my own plugin.

Well anyway. It wasn’t fixed, I just got a couple of successful stages after removing the "s.

Looks like it adds deeper child directories every time I stage, so I’ve added a directory deletion to the process and that seems to have worked around the problem.

Nothing wrong the the "s. I’ve put them back now.

Seems like a bug in RunUAT though!

Hello theonecalledtom,

Thank you for all of the information. I’ll be taking a look at this but just started so I don’t have much information yet. I did want to ask however; Are you able to reproduce this issue in a fresh project or is it something only occurring with the project you’re working in? Having a reproduction case would help a lot in a case like this.

Hi ,

I was able to get a repro in a fresh project, this time in 4.11 Preview 4, very easily.

  • Create a new project
  • Add a DLC plugin (I’ve attached a of the one I used to repro)
  • In the project launcher setup profiles for a release 1.0 build (WindowsNoEditor) and plugin DLC based on that release.
  • Build the Release 1.0
  • Build the DLC, and again, and again, and again (my test project fails on attempt number 3 but I would guess it depends on your original path length)
  • Delete the plugins/dlc/saved folder and try again… it’ll work the same number of times

As far as I can tell my test is pure Unreal and doesn’t have any me in it.

Here’s the path that is getting longer and longer with each build - see the repetition on “StagingTest\Plugins\DLC\Saved”

C:\Users\\Documents\Unreal Projects\StagingTest\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\StagingTest\Plugins\DLC\Saved\StagedBuilds\WindowsNoEditor\StagingTest\Plugins\DLC

link text

Thank you for the steps. Unfortunately, I’m not getting the same issue. Could you specify what settings you’re using for your Release and DLC profiles in the Project Launcher? That is the only thing what was vague about your previous post which could be there the missing detail is.

Base profile:

  • Build
    • ticked, though I’m not sure it needs to be
  • Configuration: Development
  • Cook
  • By the Book
  • WindowNoEditor
  • Ticked: Create a release version of the game for distribution
  • Name: 1.0
  • Advanced setrtings
  • ticked: Compress Content
    
  • ticked: Save packages without versions
    
  • ticked: Store all content in a single file (UnrealPak)
    
  • Package
  • Package & store locally
  • Deploy
  • Do not deploy

DLC profile

  • Same except:
  • Build
  • NOT ticked
  • Release / DLC / Patching Settings
  • NOT ticked: Create a release
  • Name: Empty
  • Release Version this is based on
  • 1.0
    

Steps:

  1. Build the Base profile, click Done
  2. Build the DLC profile, click Run at the end (not done).
  3. Keep clicking Run

Could be that making the DLC configuration build a pak file is critical.

Thank you for those settings. I’ve reproduced it but I do have a quick question before I put the report in, seeing as the plugin can’t be used in earlier version of the engine. Did this occur for you at all in 4.9 or any earlier builds of the engine or did it start with 4.10.2?

Sorry - I didn’t try packing prior to 4.10 beyond the occasional test.

Hello theonecalledtom,

I’m still looking into this problem. I just wanted to let you know that I haven’t forgotten about your issue and I’ll let you know whenever I have more information.

Thanks ! My workflow is out of the norm, which in this case makes it easy for me to automatically nuke the directories ever time I package but I figure it’ll bite others down the line as the plugin system gets more exercise.

I’ve been looking into this further and decided to place a bug report in for the issue. For reference, the report’s number is UE-27067. I’ll be sure to update you on its status when it gets updated, but in the meantime I can’t really think of any other workarounds past deleting those directories.

Have a nice day!

I’ve fixed this in CL#2871980, there was an issue where the staging code would search for .uplugin files recursively and find the .uplugin that was copied to the Saved folder on the last run. Each new run would copy more files deeper and deeper. Good catch, thanks for reporting it :slight_smile:

few days ago i got same problem, i fixed my issue with ‘Long Path Tool’, it was worked for me, you can try, i hope
the problem will fixed. i was searching path too long delete files problem and found it, nice conversation, its helped me.

my friend i was in same issue, i fixed my issue with"Long Path Tool",
i was search -filename too long for
destination folder- and found the video,
its just awesome, thanks nice conversation here if you want you
can try first time and see the result. thanks

I am getting this same issue and its very difficult to solve this problem without any third party app, i guess the best thing to do is to use a third party app like Long Path Tool. Just download it and use it to solve this issue. I hope this would help.

You are getting this problem probably because windows does not allow path name more than 255 characters. Like, consider this example–C:\oraclxe\app\oracle\diag\tnslr\user\listener\me.txt, In this “me” file will not be counted as 2 character but will be counted as number of characters in the path name. You can try GS Richcopy 360. I am currently using this software and it has worked for me and my enterprise to solve all our problems related to file copying. Try it, it helps.