Windows server crashes at launch depending on where it was packaged from

Hey,

I’ve got a bit of a weird issue - If I package and try to run a Windows ‘Development Server’ build from a project located at “C:\Dev\<ProjectName>” I get the following crash when the server starts up:

Fatal error: [File:C:/Dev/UnrealEngine/Engine/Source/Runtime/Core/Private/Internationalization/ICUInternationalization.cpp] [Line: 153] 
ICU data directory was not discovered:
../../../ProjectName/Content/Internationalization
../../../Engine/Content/Internationalization

If I move the project to the default UE4 projects folder (“C:\Users\<Username>\Documents\Unreal Projects\<ProjectName>”) and re-run the exact same steps to package and run a server build then everything works fine (and if I move the project back into “C:\Dev\<ProjectName>” and re-package the server it breaks again).

I’ve tried creating blank projects in both locations to test with and every single time building a server build from the “C:\Dev\<ProjectName>” folder always results in this crash (project name seems irrelevant and can be anything), but building the server from the “Unreal Projects” folder works without any issues every time.

I’m using a clean checkout of the “4.27-plus” branch from GitHub with no modifications. To build the server I’ve followed the steps in this article and then I package the server through the editor via “File” > “Package Project” > Set “Build Target” to “ProjectNameServer” and select the platform as “Windows”. I output build into “C:\Dev\<ProjectName>\Package”.

To run the server I’ve tried both via command prompt and via Visual Studio using the “Development Server” build configuration. Neither method seems to make any difference (the crash happens all of the time when its build from “C:\Dev\<ProjectName>” folder).

Has anyone seen anything similar or have any ideas on how to track down what could be causing this?

Thanks!

Managed to get to the bottom of this one. It looks like FPaths::EngineContentDir() was being set incorrectly when the project was located inside C:\Dev\<ProjectName> because inside GenericPlatformMisc::MakeEngineDir it first checks if the directory “C:/Dev/<ProjectName>/Binaries/Win64/…/…/…/Engine/Binaries” exits. If it does it assumes this is the location of the Unreal Engine binaries folder.

However, in my case I have a git repo checked out into C:\Dev\Engine which just so happens to use a similar directory naming structure to UE4 (it has a sub-dir called “Binaries” where it outputs its compiled files).

UE4 was picking this up and thinking this was the location of Unreal Engine and therefore setting the engine directory to the wrong location.

Renaming, moving or deleting the folder “C:\Dev\Engine” fixes the issue and UE4 is able to correctly work out where the engine is installed to.