Download

help ! package non UFS files

I have some sqlite db files put in ‘content/datatable’ directory, these files work fine on windows but not on andriod, maybe the db files were not packaged in apk or the obb file ? what should I do ?

Hi Rain,

Try using the “Additional Non-Asset Directories to Package” (or “To Copy”, depending on how you are loading them) option in your project settings.

NonAssetDirectories.png

Cheers,
Michael Noland

I had tried this before, but it didn’t work. The sqlite lib open db files with it’s own IO api, so I checked “Additional Non-Asset Directories To Copy”, but the db files were not found after the package stage(or they were inside the pak or obb file ? i don’t know) and I didn’t know the path to load the db files after the game was installed…

If you aren’t using the Unreal file wrappers, you probably want the option below the one I highlighted (‘to Copy’, instead of ‘to Package’). If you place the database in a folder in the To Copy list, it shouldn’t be part of the unreal .pak file and should be accessible by regular platform means.

Cheers,
Michael Noland

Sorry to dig up this old topic but it’s very relevant to myself. I have a SQLite3 db file which no matter what refuses to pack correctly with my APK, I’ve tried all the packing options and I have asked around so my only hope with be a developer who may be able to help me with this.

Please take a look at this forum post for more information on accessing non UFS files: https://forums.unrealengine.com/showthread.php?102830-4-10-Android-package-custom-files-along

Hey thanks for the response, I’ve done this and now I finally confirmed that the db file exists within Android but the problem I am recieving is the response from the SQL database being loaded in fails as well as FPath directory functions not returning files in directories that I’m aware contain files.

This is my logcat printout:


D/UE4     (13260): [2016.09.19-23.50.11:129]-9142848]LogTemp:Warning: #!!# RelativePathRoot: ../../../ #!!#
D/UE4     (13260): [2016.09.19-23.50.11:129]-9142848]LogTemp:Warning: #!!# GameUsr: ../../../Settlements/ #!!#
D/UE4     (13260): [2016.09.19-23.50.11:129]-9142848]LogTemp:Warning: #!!# GameUsrDev: ../../../Settlements/Content/Developers/GenericUser/ #!!#
D/UE4     (13260): [2016.09.19-23.50.11:130]-9142848]LogTemp:Warning: #!!# GameContentDir: ../../../Settlements/Content/ #!!#
D/UE4     (13260): [2016.09.19-23.50.11:130]-9142848]LogTemp:Warning: #!!# GameContentDir EDIT: ../../../Settlements/Content/GUI/ #!!#
D/UE4     (13260): [2016.09.19-23.50.11:130]-9142848]LogTemp:Warning: #!!# EXISTS #!!#

This is the code that provoked it:



FString Root = FPaths::GetRelativePathToRoot();
UE_LOG(LogTemp, Warning, TEXT("#!!# RelativePathRoot: %s #!!#"), *Root)

FString GameUsr = FPaths::GameUserDir();
UE_LOG(LogTemp, Warning, TEXT("#!!# GameUsr: %s #!!#"), *GameUsr)

FString GameUsrDev = FPaths::GameUserDeveloperDir();
UE_LOG(LogTemp, Warning, TEXT("#!!# GameUsrDev: %s #!!#"), *GameUsrDev)

FString GameContentDir = FPaths::GameContentDir();
UE_LOG(LogTemp, Warning, TEXT("#!!# GameContentDir: %s #!!#"), *GameContentDir)

GameContentDir = "../../../Settlements/Content/GUI/";
UE_LOG(LogTemp, Warning, TEXT("#!!# GameContentDir EDIT: %s #!!#"), *GameContentDir)

if(bool doesExist = FPaths::DirectoryExists(GameContentDir)) {
   UE_LOG(LogTemp, Warning, TEXT("#!!# EXISTS #!!#"))
} else {
   UE_LOG(LogTemp, Warning, TEXT("#!!# DOES NOT EXIST #!!#"))
}

TArray<FString> output;
output.Empty();

GameContentDir += "/";

IFileManager& fileManager = IFileManager::Get();
fileManager.FindFiles(output, *GameContentDir, true, true);

for(int i = 0; i < output.Num(); i++) {
	UE_LOG(LogTemp, Warning, TEXT("#!!# FileFound: %i: %s #!!#"), i, *output*)
}


Despite the correct directories being returned I can never pick up any files with FindFiles or any of the other API functions supplied. Is this a Linux/Android problem? I’ve noticed a whole range of unanswered Answerhub questions that share the same problem with this and not one has a response.

These are two prime examples:
https://answers.unrealengine.com/questions/303369/need-help-with-see-the-files-on-diretory-on-androi.html
https://answers.unrealengine.com/questions/94379/why-iplatformfileiteratedirectory-does-not-work-on.html

Could I get some proffesional help with this issue that has driven me insane over the past couple of days.

Thank you for your time.

*Edit - I’m currently wrestling with the code snippet you linked to see if this will operate correctly. Thank you, I will return after attempting

The files will be in the package (either in the APK or OBB) inside a PAK file. The Unreal file system can read these, but you cannot get to them with system file calls. If your library does not provide a way to override file I/O, or take a memory file, you will need to use the code I provided in the other forum post to copy the file outside to access. You will need to do this anyway if you mean to modify it.

GExternalFilePath is persistent so you only need to do this once (check for the file existing here before doing the copy at startup). This directory will also be deleted when the application is uninstalled.

I finally got around to understanding fully and that allowed me to fix the issue, I’m going to upload the plugin with the android support to Github later, thank you for your time and help