UE4Editor load .ini files accroding to operating system but not cooking platform.

When I launch UE4Editor in windows, and use UE4Editor to cook contents for targetplatform=linux, UE4Editor load config files which in Config/Windows folder instead of Config/Linux folder.
Therefore, the directories which marked as “DirectoriesToNeverCook” in LinuxGame.ini will still be cooked.

So, it is a bug in UE4Editor? And how can I load LinuxGame.ini for UE4Editor in Windows, and use UE4Editor to cook files in correct directory according to LinuxGame.ini.

1 Like

This is a known issue, which is still present in UE5.

A workaround I’ve found is to create a file Config/DefaultPakFileRules.ini.
See instructions in the Engine’s version: \Engine\Config\BasePakFileRules.ini

You can exclude folders of content like this:

[ExcludeContentForWindows]
Platforms="Windows"
bExcludeFromPaks=true
bOverrideChunkManifest=true
+Files=".../Content/<YourGame>/Folder/Path/*"

The files are stripped out post-cook.
To verify it worked, you can double-check that the files you want to exclude are NOT listed in the AutomationTool’s list of pak items in: <Engine>\Engine\Programs\AutomationTool\Saved\Logs\PakList_pakchunkX-<Platform>.txt

1 Like

Thanks, it seems to work in the stage of Staging, but not in the stage of Cooking? The Files listed in this section seems to still be cooked, but it will not be added into pak.