# External File Use

**URL:** <https://forums.unrealengine.com/t/external-file-use/676111>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [October 24, 2022, 3:55pm UTC](https://forums.unrealengine.com/t/external-file-use/676111 "2022-10-24T15:55:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.carter1182](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@a.carter1182](https://forums.unrealengine.com/u/a.carter1182)\
**Post date:** [October 24, 2022, 3:55pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/1 "2022-10-24T15:55:11Z")

</div>

Using UE5, I was able to Include a header from an external folder on my pc but that header had an include to another file which was in the same folder but UE could not find it. I saw that in previous versions you would do a PublicIncludePaths(List) but that is no longer the case with UE5 from what I’ve read. So…

#include “/dir1/dir2/dir3/file.hpp” \<— found it! But on compile…  
cannot find "/dir3/file2.hpp \<— this is an #include of file.hpp

Please help me to solve this issue. I dont think I can install all of that external stuff into my project so I’d like it to remain external on my machine for now. Thank you.

CPP, Programming

---

<div class="post-metadata">

**Author:** ![ZenLeviathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zenleviathan/32/551307_2.png) [@ZenLeviathan](https://forums.unrealengine.com/u/ZenLeviathan)\
**Post date:** [October 24, 2022, 4:14pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/2 "2022-10-24T16:14:33Z")

</div>

Hey @a.carter1182, I’ve also seen this kind of issue regarding the scope of android projects, so maybe the fix for them might work for you as well:

> [@How to access an external file in-game](https://forums.unrealengine.com/t/how-to-access-an-external-file-in-game/62203/2):
>
> Hi Mosel3y, If you look in AndroidFile.cpp in PathToAndroidPaths(), there are checks for valid paths to allow: if ((AllowLocal && AndroidPath.StartsWith(TEXT("/"))) || AndroidPath.StartsWith(GFontPathBase) || AndroidPath.StartsWith(TEXT("/system/etc/")) || AndroidPath.StartsWith(GExternalFilePath.Left(AndroidPath.Len()))) { // Absolute paths are only local. LocalPath = AndroidPath; AssetPath = AndroidPath; } Just change this to if (AllowLocal) and it should…

It seems Unreal has a few checks for the locality of the files. It seems that using something other than the FPaths might work, as this discussion thread describes:

> [@How to get external file with Fpaths?](https://forums.unrealengine.com/t/how-to-get-external-file-with-fpaths/436798/4):
>
> So if you’re trying to get a file from your computer in C++, you should be able to write something like this: FFileHelper::LoadFileToString(SaveTextA, \*"e:/drive/temp/text/textfile.txt";) And just get the file directly, instead of using FPaths. The point of FPaths is to help you get files from common places on any computer, regardless of installation location. If you know your file will always be at “e:/drive/temp/text/textfile.txt” then you could use what I posted above. Although you should k…

I hope some of these can help answer your question, let me know if it doesn’t!  
-Zen 🖖

---

<div class="post-metadata">

**Author:** ![a.carter1182](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@a.carter1182](https://forums.unrealengine.com/u/a.carter1182)\
**Post date:** [October 24, 2022, 4:31pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/3 "2022-10-24T16:31:05Z")

</div>

Thanks for the reply I’ll have a look and get back to you!

---

<div class="post-metadata">

**Author:** ![a.carter1182](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@a.carter1182](https://forums.unrealengine.com/u/a.carter1182)\
**Post date:** [October 24, 2022, 8:24pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/4 "2022-10-24T20:24:44Z")

</div>

Thanks for the try but I havent found anything similar to that AndroidFile.cpp from what I have. I really dont have anything special its just a 3rd person template to try a few things but will heavily rely on pulling in some external stuff and its the first roadblock we expected to hit.

---

<div class="post-metadata">

**Author:** ![ZenLeviathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zenleviathan/32/551307_2.png) [@ZenLeviathan](https://forums.unrealengine.com/u/ZenLeviathan)\
**Post date:** [October 25, 2022, 3:10pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/5 "2022-10-25T15:10:12Z")

</div>

@a.carter1182,  
Sorry that it didn’t help! What I’m thinking now is you might need to change the world settings, there should be an option here to allow External Actors:

 ![snip4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/3/af38b94baa60363308974da2a7b0e16627b55aee.png)  
Other than that, I would recommend maybe checking out the One File Per Actor Docs, or the use of CoreMisc.h, that could be a way to learn some more about the reading and writing Unreal does:

> **[One File Per Actor](https://docs.unrealengine.com/5.0/en-US/one-file-per-actor-in-unreal-engine/)**
>
> An introduction to the One File Per Actor System and how it can be used in your projects.

I hope some of this can help, and let me know if you’re still having issues!  
-Zen 🖖

---

<div class="post-metadata">

**Author:** ![a.carter1182](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@a.carter1182](https://forums.unrealengine.com/u/a.carter1182)\
**Post date:** [October 28, 2022, 12:48pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/6 "2022-10-28T12:48:21Z")

</div>

Ok so while the suggestions above didnt work out, I was able to get something going but its not 100%. But from the project.build.cs file I added in…  
PublicSystemIncludePaths.Add(“/dir1/dir2/dir3”) and have been able to start accessing/reading the files I want. However, I do have to do an #include for every header file needed down the chain. Example:

file1  
#include “dir3/file4.h”  
#include “dir3/file3.h”  
#include “dir3/file2.h”  
#include “dir3/file1.h”

file1 includes external file2, and file2 includes external file3 and file3 includes external file4, and all the includes are being put into file1 and its working up til I have an include for a macro.h and then this solution stops working. I assume its how a macro.h file is written so I’m continuing to look some more

---

<div class="post-metadata">

**Author:** ![ZenLeviathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zenleviathan/32/551307_2.png) [@ZenLeviathan](https://forums.unrealengine.com/u/ZenLeviathan)\
**Post date:** [October 30, 2022, 9:33pm UTC](https://forums.unrealengine.com/t/external-file-use/676111/7 "2022-10-30T21:33:05Z")

</div>

Hey @a.carter1182  
I haven’t found much for free, but I’ve also been trying to find some plugins that may be worth some value to you:

> **[File Access Library in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/file-access-library)**
>
> Easy access of files & directories and delete or load them in runtime

Are the functions you’re trying to access static functions? I’ve seen issues without it being static when reading over files like this before.  
I hope this can help!  
-Zen
