[Android]FPaths::ConvertRelativePathToFull didn't work

hi, I just try to convert my relative path to full path, but it seems didn’t work on android (windows is ok), here is my test code:

FString relativePath = “…/…/…/MyProject/PersistentDownloadDir/Horizon/”;
FString fullPath = FPaths::ConvertRelativePathToFull(relativePath );
UE_LOG(LogTemp, Log, TEXT("======================ConvertRelativePathToFull: %s"), *fullPath);

When trace into the code, I notice that FAndroidPlatformProcess::BaseDir() is empty, so it will be return immediately in Engine\Source\Runtime\Core\Private\Misc\Paths.cpp:724 while code call CollapseRelativeDirectories.

That’s why ConvertRelativePathToFull didn’t work.

Hello dorgon,

From speaking to one of our Android developers, this is intended and BaseDir() should be returning nothing when on mobile devices, seeing as the folders from your PC do not exist on the device and it wouldn’t make much sense to replace the relative path with the full original path.

Hi, I am trying to integrate sqlite3 into my project and it need full file path in android in order to create db file correctly. I find GetFileBasePath(); in Engine/Source/Runtime/Core/Private/Android/AndroidFile.cpp is what I need but it didn’t has interface let me access it from my project.

You shouldn’t try to read or write to GetFileBasePath() directly since anything here is possibly inside another file wrapper. You should read and write native files to GExternalFilePath instead. If you really need to get this, though, you can do it like so:

FString GetAndroidFileBasePath()
{
#if PLATFORM_ANDROID
	extern FString GFilePathBase;
	return GFilePathBase + FString("/UE4Game/") + FApp:GetGameName() + FString("/");
#else
	return FString("");
#endif
}

Hi,

Thanks for your reply.

This solution is exactly what I want, I already create my sqlite3 db successfully at GExternalFilePath.

But I notice there are some file store at
GFilePathBase + FString(“/UE4Game/”) + FApp::GetGameName() + FString(“/”) that are not be deleted after user uninstall app.

Could you please tell me why those file store at GFilePathBase instead of store in GExternalFilePath?

anything here is possibly inside another file wrapper.

I am not sure what is the meaning that those file will inside another file wrapper.

Thanks!