FPakPlatformFile make public?

I am using FPakPlatformFile::GetMountedPaks
and FPakPlatformFile::FPakListEntry
to find a list of all *.umaps in my game.

The problem is to do this I need to modify IPlatformFilePak.h and make FPakPlatformFile public like so:

class PAKFILE_API FPakPlatformFile : public IPlatformFile { public: // I ADDED THIS HERE

Can this be made in the ue4 engine to save me having to modify the ue4 engine?

Hey supagu-

Looking at the declaration of FPakPlatformFile inisde IPlatformFilePak.h, it is already declared with “public IPlatformFile” as you suggested. If you are having problems using this class in your project it may be helpful to create a post with specific examples of what you are doing and what unexpected results you’re getting.


Here is a source code snippet, I am trying to get a list of all *.umap files in any loaded pak files. The problem is some of the functionality I wish to use - GetMountedPaks and FPakListEntry are private:

	TArray<FPakPlatformFile::FPakListEntry> MountedPaks;
	for (int32 i = 0; i < MountedPaks.Num(); i++)
		const FPakPlatformFile::FPakListEntry& mountedPak = MountedPaks[i];
		const TMap<FString, FPakDirectory>& pakDirectoryMap = mountedPak.PakFile->GetIndex();

		//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, *mountedPak.PakFile->GetFilename());
		//UE_LOG(LogClass, Log, TEXT("PAK File: %s"), *mountedPak.PakFile->GetFilename());

		FString filename = mountedPak.PakFile->GetFilename();
		FString mountPoint = mountedPak.PakFile->GetMountPoint();

		for (TMap<FString, FPakDirectory>::TConstIterator It(pakDirectoryMap); It; ++It)
			FString Key = It.Key();
			const FPakDirectory& Val = It.Value();

			for (FPakDirectory::TConstIterator It2(Val); It2; ++It2)
				FString Filename = It2.Key();
				FPakEntry* pakEntry = It2.Value();

				if (Filename.Contains(TEXT(".umap")))
					FString FullFilename = mountPoint + Filename;

					FString Error;
					FString LongPackageName;
					FPackageName::TryConvertFilenameToLongPackageName(FullFilename, LongPackageName, &Error);
					//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *Key2);
					//UE_LOG(LogClass, Log, TEXT("UMAP File: %s"), *Key2);

Do you have “PakFile” inside of PublicDependencyModuleNames.AddRange() in the [ProjectName].Build.cs file? Let me know if adding this, along with proper include statements, allow you to use the FPakPlatformFile class.

So I just updated to 4.11 preview 3 today but same error:

‘FPakPlatformFile::FPakListEntry’: cannot access private struct declared in class ‘FPakPlatformFile’
‘FPakPlatformFile::GetMountedPaks’: cannot access private member declared in class ‘FPakPlatformFile’

and yes I have the include:

#include “IPlatformFilePak.h”


“PakFile” in my PublicDependencyModuleNames.

again looking at IPlatformFilePak.h:

class PAKFILE_API FPakPlatformFile : public IPlatformFile
	struct FPakListEntry

changing too:

class PAKFILE_API FPakPlatformFile : public IPlatformFile
	struct FPakListEntry

fixes the issues

Hey supagu-

I’ve entered a feature request to have the public access specifier added to the FPakPlatformFile class (UE-25737). If you are using a source built engine then you should be able to make this change locally for your engine.



I know this post is quite old but I am currently stuck on this same issue: I am able to find the .umap files in the .pak but TryToConvertFilenameToLongPackage fails.
From a first investigation it seems that it does not like the fact that my mount point begins with “…/…/…/”, but even if I call ConvertRelativePathToFull I get the same error.

What am I missing?