You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use Jetbrains Expose with an SQLite database for persistence in my Compose Desktop app, but I'm not sure how to create and read the database file after packaging my app.
I'm assuming the easiest way is to use the App's 'App Data' directory as the app should have permissions for this already. This is what I've done in the past with Swift, but I'm not sure how I do it with Kotlin + Compose Desktop.
For reference, this is what I'm currently calling, and it works in development because the file exists in my project directory, but crashes when packaged since the file no longer exists.
Here's an example of the sort of thing I would do in Swift
// Get the Apps document directory
guard let documentDirectoryUrl =FileManager.default.urls(for:.documentDirectory, in:.userDomainMask).first else{return}// Append the database file to the pathletfileUrl= documentDirectoryUrl.appendingPathComponent("data.db")print(fileUrl.absoluteString)// Check if file exists
if !fileManager.fileExists(atPath: fileUrl.path){// create file}else{// load file}
I hope that makes sense, I'm also open to other solutions if I'm going in the wrong direction with Compose Desktop
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm trying to use Jetbrains Expose with an SQLite database for persistence in my Compose Desktop app, but I'm not sure how to create and read the database file after packaging my app.
I'm assuming the easiest way is to use the App's 'App Data' directory as the app should have permissions for this already. This is what I've done in the past with Swift, but I'm not sure how I do it with Kotlin + Compose Desktop.
For reference, this is what I'm currently calling, and it works in development because the file exists in my project directory, but crashes when packaged since the file no longer exists.
Here's an example of the sort of thing I would do in Swift
I hope that makes sense, I'm also open to other solutions if I'm going in the wrong direction with Compose Desktop
Thanks
Beta Was this translation helpful? Give feedback.
All reactions