Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

FPaths, FFileHelper and IFileManager after packaging

Hi there,

In order to allow the player to add custom simple dialogue chains to the game, I created a new plugin and added the following two blueprint nodes - one for finding all txt files inside a 'Mods' subfolder inside Content folder, and another to read these txt files:


 class UModdingPlus : public UObject
     UFUNCTION(BlueprintPure, Category = "ModdingPlus")
     static bool GetAllFilesFromFolder(TArray<FString>& Files, FString RootFolderFullPath, FString Ext);
     UFUNCTION(BlueprintPure, Category = "ModdingPlus", meta = (Keywords = "LoadTxt"))
     static bool LoadTxt(FString FileNameA, FString& SaveTextA);


 bool UModdingPlus::GetAllFilesFromFolder(TArray<FString>& Files, FString RootFolderFullPath, FString Ext)
      if(RootFolderFullPath.Len() < 1) return false;
      // FPaths::NormalizeDirectoryName(RootFolderFullPath);
      //RootFolderFullPath = FPaths::ConvertRelativePathToFull(RootFolderFullPath);
      IFileManager& FileManager = IFileManager::Get();
      FString RelativePath = FPaths::GameContentDir();
      FString FullPath = FileManager.ConvertToAbsolutePathForExternalAppForRead(*RelativePath);
      if(Ext == "") 
          Ext = "*.*";
          Ext = (Ext.Left(1) == ".") ? "*" + Ext : "*." + Ext;
      FString FinalPath = FullPath + "/" + RootFolderFullPath + "/" + Ext;
      FileManager.FindFiles(Files, *FinalPath, true, false);
      return true;                  
  bool UModdingPlus::LoadTxt(FString FileNameA, FString& SaveTextA)
      return FFileHelper::LoadFileToString(SaveTextA, *(FPaths::GameContentDir() + FileNameA));

These blueprint nodes work perfectly for me when I play in editor - the txt files are found correctly inside the Mods folder, and their contents are converted to strings as expected.

However, both of these function return false as soon as I package the project (with the Mods folder manually copied into the built game's Content folder).

Is there anything I could do? Or is it hard-coded that the packaged game cannot read external files?

Thank you so much in advance!

Product Version: UE 4.18
more ▼

asked Dec 15 '17 at 07:05 AM in C++ Programming

avatar image

Philip Nguyen
11 1 1 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I have a same probleme. I'm too in UE4.18. I see https://wiki.unrealengine.com/Packaged_Game_Paths,_Obtain_Directories_Based_on_Executable_Location But not work. How do ?

more ▼

answered Jun 30 '18 at 08:45 AM

avatar image


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

While I know this is an old question, I recently encountered and solved the same issue myself. BTW, this issue has been around since 4.10 at least; and is present all the way through 4.19. My issue was that when I would package my project from within the Editor, any File Management functions for validating things like "FileExists" or "DirectoryExists" always returned false.

This behavior could not be seen when playing in Editor or StandAlone launched from the Editor.

The solution is to Package the project from the UE FrontEnd tool. All of my file management functions continue to work without issue then.

Important Note: The UE FrontEnd is a program (Binary) that you build from the Engine Source Code VS Solution. Once the FrontEnd program has been built from source (in Visual Studio for example), then you will find its EXE under the engine binaries like the UE-Editor. If you're using the public (non-source) engine that you downloaded via the Epic Launcher; the FrontEnd will not be available to you, even if your project is c++ based.

more ▼

answered Jul 11 '18 at 01:02 PM

avatar image

52 1 5 4

avatar image Rumbleball Oct 08 '18 at 05:28 PM

Do you have access to the commandline that is used when you package with unreal FrontEnd? Just came across that issue... Should be doable without unreal FrontEnd, just the commandline is wrong.

Edit: I entered a bug report.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question