GetFolderItem replacement

I have an older SQLite database that I’m trying to create a folder next to the app, where I can put the database and the backups. So how to I capture that?

This is what I had before:

DBfolder = GetFolderItem( “”).Child(App.kAppName +"_Data")
DBfile = GetFolderItem( “”).Child(App.kAppName + “_Data”).Child(App.kAppName +“DB.sqlite”)
BackupFolder = GetFolderItem( “”).Child(App.kAppName + “_Data”).Child(“Backups”)

It still works, but since it’s been deprecated, I’d like to know the current way of doing this.

Thanks,
Michael

DBfolder = App.ExecutableFile.Parent.Child(App.kAppName +"_Data") DBfile = DBfolder.Child(App.kAppName +"DB.sqlite") BackupFolder = DBfolder.Child("Backups")

Those are just the locations - if the folder doesn’t exist, you’ll need to create it with f.CreateFolder.

Also check out the New Folderitem constructor.

This only makes sense if your app is not in Applications or Program Files

Otherwise, ‘data next to the app’ simply won’t work

Use ApplicationData instead

DBfolder = specialfolder.applicationdata.child(App.kAppName +"_Data") //check DBFolder and create if need be DBfile = DBfolder.Child(App.kAppName +"DB.sqlite") //check DBFile and create if need be BackupFolder = DBfolder.Child("Backups") //check BackupFolder and create if need be

Thank you! Jeff, just so you know, I normally keep the data files & folders in Documents. I just wanted to see to do to this without GetFolderItem.