How to get absolute path on iOS?

I am using sqlite3 in my project , i need to create a MyDatabase.db file to store something.

To create this file, what i have tried:

1.IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*FPaths::GameContentDir().ToLower());

2.FPaths::ConvertRelativePathToFull(FPaths::GameContentDir() );

to get a absolute path where i can create my file.

it works fine on Mac/Windows, but on iOS it seems these two uses IOSPlatformProcess.cpp-> BaseDir() , which just return “”.

so ,is there some way to get this path? or do i have to use object-c to get path?

Try FPaths::GameSavedDir()

I figure it out:

using:

NSArray *documentArr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentPath = [documentArr firstObject];

NSString *path2 = [NSString stringWithFormat:@"%@/mydata.db",documentPath];

FString path(path2);

is this code in Object C ?

It is… you can do that!

I still don’t know why you wouldn’t use GameSavedDir though, that’s where I put my downloaded content. Probably a reason though…! :slight_smile: