Issue with SQLite Core in shipping

So, my game is working very well in Development, but in Shipping I noticed that the SQLite reader could only reach the first rows.

It tooks me like 14 hours to debug this issue, it turned out that when the sqlite query is created, a temporary file is created, and it uses this code in SQLiteEmbeddedPlatform at line 440:

static const FString TmpPath = FPaths::ProjectIntermediateDir() / TEXT(“SQLite”);

I have added my own trace to see what was going on and in Development it generates this:

open write …/…/…/…/…/Projects/MyProject/Intermediate/SQLite/F94D924042B29E1344BA50B2DD1AED2A.tmp 92a7cee0

whereas in Shipping it generates this:

open write C:/Users/myusername/AppData/Local/MyApp/Intermediate/SQLite/29EB64694F56648C5E88FAACD1724396.tmp 00000000

and that fails (00000000 means that the file handle is nullptr), unless of course I create the folders Intermediate/SQLite under AppData/Local/MyApp

So, how am I supposed to handle this, create the folders at app creation or did I forget a parameter somewhere?

ETA: note that at line 441 there is:

PlatformFile.CreateDirectory(*TmpPath);

but it does not seem to work in Shipping.

I have replaced the line #441 with:

		PlatformFile.CreateDirectoryTree(*TmpPath);

and that fixed the issue.