Description

Originated from UDN post:
https://udn.unrealengine.com/s/question/0D5QP000007QWuz0AG/additionalplugindirectories-outside-of-project-visual-studio-and-zenstore

QUOTE:
TLDR: Use of 'escape' paths in Uproject's AdditionalPluginDirectories seems to break Visual Studio launches, as well as Zenstore.

Much more detail:

We added a AdditionalPluginDirectories like the code chunk to our MyGame/MyGame.uproject. The important part to note is that it starts with "../" which 'escapes' the MyGame folder. And, we have a code plugin in that directory. This mostly works.

What works: Editor Builds, packaged builds (e..g from our farm)

What doesn't: Win64 builds launched from Visual Studio, Zenstore launches. These are detailed below

1) Win64 builds from Visual Studio fail to launch

Our engineers have a common habit of cooking locally, but not the full pak/stage step. For example, "RunUAT.bat BuildCookRun -project="MyGame/MyGame.uproject" -noP4 -nocompileeditor -utf8output -build -cook -SkipCookingEditorContent -stage -iterate

Then, we launch say Development|Win64 from Visual Studio with default debugging commands. This used to work.

That cook leaves a game\MyGame\Saved\StagedBuilds\Windows\RemappedPlugins folder with the .uplugin folder. If I launch from Development\Win64 from Visual Studio, it fails with a "LogPluginManager: Error: Unable to load plugin 'CompanySharedPlugin'. Aborting."

Debugging this, in FProjectDescriptor::Read(), in non-Editor builds, it adds this path: "C:/path/to/unreal/game/MyGame/Saved/Cooked/Windows/RemappedPlugins" . Problem is, that doesn't exist. The cook above created "Saved/StagedBuilds/Windows/RemappedPlugins" Thus, it fails.

That's with the stock empty (blank) commandline arguments from Visual Studio. It doesn't use that StagedBuilds*\RemappedPlugins folder. It looks like commandline PLUGIN= or setting %UE_ADDITIONAL_PLUGIN_PATHS%, it could succeed, but that requires every engineer to edit things locally.

2) Zenstore launches on platforms fail

This is even more tricky to debug. A zenstore cook of that platform left the artifacts in Saved\StagedBuilds\<Platform>\remappedplugins . Launching from my Platform, it "../../../mygame/../remappedplugins/" to the list of folders to look in.

In FStorageServerPlatformFile::DirectoryExists(), the call to MakeStorageServerPath() turns stock paths into items like "../../../engine/Plugins" -> "/

{engine}

/Plugins" . That works well, but it might be a code change to find the RemappedPlugins folder.

Yes, I know Zenstore is still under development, but it's been a huge win for Platform iteration.

I've looked ahead to the 5.4 (live snapshot) in Perforce, and I don't see changes to PluginManager.cpp, ProjectDescriptor.cpp that look like it would fix it.

Thanks for your help.

"AdditionalPluginDirectories": [
	"../CompanyShared/Plugins"
],

Here's a snippet of code to add to FProjectDescriptor::Read() that seems to at least fix the Development|Win64 launch. Zenstore for Platforms is likely to need more changes.

		// If this is a packaged build and there are additional directories, they need to be remapped to the packaged location
		if (FPlatformProperties::RequiresCookedData() && AdditionalPluginDirectoriesValue->Num() > 0)
		{
			AdditionalPluginDirectories.Empty();
			FString RemappedDir = FPaths::ProjectDir() / TEXT("../RemappedPlugins/");
			if (FPaths::IsRelative(RemappedDir))
			{
				RemappedDir = IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*RemappedDir);
			}
			AddPluginDirectory(RemappedDir);
 
// BEGIN ADDED CODE
			// After cooking with RunUAT.bat BuildCookRun -project="MyGame/MyGame.uproject" -noP4 -nocompileeditor -utf8output  -build -cook -SkipCookingEditorContent -stage -iterate -platform=Windows
			// and then launching from VisualStudio, by default, right now  RemappedDir=="Saved/Cooked/Windows/RemappedPlugins", but the RunUAT left files in
			// "Saved/StagedBuilds/Windows/RemappedPlugins" . So, add a second search path transparently.
#if !UE_BUILD_SHIPPING && !WITH_EDITOR
			static const FString COOKED_FOLDER = TEXT("/Cooked/");
			static const FString STAGED_FOLDER = TEXT("/StagedBuilds/");
			if (RemappedDir.Contains(COOKED_FOLDER))
			{
				FString RemappedDir2 = RemappedDir.Replace(*COOKED_FOLDER, *STAGED_FOLDER);
				AddPluginDirectory(RemappedDir2);
			}
#endif
// END ADDED CODE
		}

Have Comments or More Details?

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

0
Login to Vote

Unresolved
ComponentUE - Foundation - Core
Target Fix5.6
CreatedMar 14, 2024
UpdatedSep 18, 2024
View Jira Issue