Using FDesktopPlatformModule::OpenDirectoryDialog() in shipping build crashes app

Hello,

I am building a game for Win64 in 4.27. When playing the game the user can take highres screenshots. Normally these screenshots are saved in a pre-determined folder. I want to give the player the possibility to change this folder using FDesktopPlatformModule::OpenDirectoryDialog(). When playing in the editor (or as stand alone) everything works as expected. However, after packaging my game for shipping and run the game outside unreal, the game crashes at the moment it should open the OpenDirectoryDialog.

Include file

UFUNCTION(BlueprintCallable, Category = "Files|Dirs")
		static void OpenDirDialog(const FString& DialogTitle, const FString& DefaultPath, FString& OutDirNames);

code

void UPBFunctionLibrary::OpenDirDialog(const FString& DialogTitle, const FString& DefaultPath, FString& OutDirNames)
{
	if (GEngine)
	{
		if (GEngine->GameViewport)
		{
			void* ParentWindowHandle = GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle();
			IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
			if (DesktopPlatform)
			{
				//Opening the file picker!
				uint32 SelectionFlag = 0; //A value of 0 represents single file selection while a value of 1 represents multiple file selection
				DesktopPlatform->OpenDirectoryDialog(ParentWindowHandle, DialogTitle, DefaultPath, OutDirNames);
			}
		}
	}
}

Does OpenDirectoryDialog only work in a non-shipping build?

Any help is appreciated.

Thanks,
Richard

Bumping because i am facing the same issue.

1 Like

I have the same problem. DesktopPlatform is a developper tool. So, in shipping built, there is no developper tool.

Did you find a way to work with DesktopPlatform in your shipping built?

I stopped trying because AFAIK including developer tools in your shipping build is against Unreal Engine’s EULA.
I guess you could look at c++ cross-platform library and include them in a plugin or if you only target windows use this plugin :