How to get directories outside of unreal?

Hello,
Im trying to find a way to get access to folders outside of unreal.
A more specific example would be that I’m trying to get the directory path to a folder inside of the Window ‘Program Files’ folder that’s on the OS drive.

The problem with that is that the drive name on which Windows is installed can be different from user to user, and so I cant set a static String as the path.

Is there any way that I can get the path to the ‘Program Files’ folder?

Thanks in advance for any help :slightly_smiling_face:

1st remember that you may have issues if you’re not an Admin on the PC because Program Files is a protected folder

2nd you can open it by using Path: %ProgramFiles% (just like the AppData) :slight_smile:

3rd there are a few free plugins allowing you to maintain/access data easier :stuck_out_tongue_winking_eye:

2 Likes

Hey, thanks for the reply. :slightly_smiling_face:

What I ended up doing at the time was using was a Windows Specific function:

#if PLATFORM_WINDOWS
     #include "Windos/AllowWindowsPlatformTypes.h"
     #indclude <Shlobj.h>
     #include "Windows/HideWindowsPlatformTypes.h"
#endif

void FMyClass::MyFunction()
{
#if PLATFORM_WINDOWS
     static Char MyPath[MAX_PATH];
     FMemory::Memset(MyPath, 0, MAX_PATH);
     SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES /*This determines what we want the 
     path to*/, NULL, 0, MyPath); 
#endif
}

I believe this way Admin rights aren’t an issue to access whatever you have inside of the folder that you need to retrieve.
Not 100% sure about that, its just my assumption.