Path to an SQLite DB

Hello,

I recently switched to Apple’s iCloud service and I’d like to move all my SQLite DB inside folders in iCloud, mostly for syncing reasons. I’ know SQLite shouldn’t be use in clouds etc. but, accepting the risk, how should I address the dbPathe to reach said DBs? In normal situations it goes: dbPath = Documents.Child(… but now there is a Document folder inside iCloud and I don’t know how to reach it.

Thank you

i think you enable documents sync in OS (that cloud data are local too), and then before you use this database
copy it temporary, use it from there, and after you finished copy it back that it will sync (copy) to cloud by OS.

correctly you would use a database server.

or this iCloud solutions is more a backup for youself.

App.db.DatabaseFile = SpecialFolder.PathToIcloud.Child(filePath).Child(fileName)

Yes, I could copy thema back and forth but it’s rather inconvenient, I’d like to leave them there and use them from there

The reason to copy them to a static path and back is because in the cloud folder, every write query will trigger a sync and be another possibility of a write collision which can corrupt your db. Copying it to a temporary location, making your changes, then copying it back only has a single chance of that.

Copying an intact database file also does a sequential write of the file to the destination rather than a write to a random position and lessens the chance of a sync interfering with the operation.

But the iCloud Drive folder is typically at SpecialFolder.UserHome.Child("Library").Child("Mobile Documents").Child("com~apple~CloudDocs")