Download

FPaths not working in packaged game

Hi,

I’m trying to read text from a file in a packaged game but am having some problems with FPaths.
In my plugin, I am returning a string for the file location, It works perfectly in the editor but not in the packaged game and the other functions of the BP Plugin work fine.



FString UBPPluginBPLibrary::GetCSVSaveLocation()
{
    return FPaths::ConvertRelativePathToFull(FPaths::GameDir());
}


After looking at the wiki, I have also tried the following

none of which seem to work and the string is left blank.

Edit: Engine Version 4.21

Just as a test, try FPaths::ProjectPersistentDownloadDir() and see what you get back from a packaged project. That’s what I use in my DLC loader and it returns a location,

Different platforms have different restrictions, that one should work on all of them.

This also works the same way.
Using FPaths::ProjectPersistentDownloadDir() I get the following in editor:
…/…/…/…/…/…/Documents/Unreal Projects/MyProject/PersistentDownloadDir
and blank in a packaged build

Are there any permissions I need to set for the plugin to be able to access files?

That seems odd. Not sure if it’ll help, but try including the AssetRegistry module.

Shouldn’t be any plugins required and that string should not be blank in a packaged build. I mean, it’s just a string.

What platform are you running it on when it’s packaged?

Running on Windows 10