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
Hello. I am testing version 0.10.0-SNAPSHOT. The absolutePath property returns the path without the file extension.
Tell me, do I understand correctly: this property can be transferred, for subsequent reading, to other modules?
The text was updated successfully, but these errors were encountered:
Hi @lemkoleg! Thanks for trying FileKit 0.10 and creating this issue.
Currently, PlatformFile.absolutePath returns the absolute path of the file with the extension except when it's an Android Uri. It's really hard to figure out the absolute path of an Android Uri. Also, on Android, when we pick some files from the picker, the system gives us Uris that are working for the lifetime of the session. When the app restarts, sometimes, we have no longer access to those files.
If your goal is to be able to access the file later on, I recommend copying that file into the filesDir or cacheDir of your application.
Here is an example of how you can save and retrieve a file from the app filesDir directory:
suspendfunsaveFileToAppStorage(externalFile:PlatformFile): PlatformFile {
// Create a file name for the saved fileval fileId =Uuid.random().toString()
val fileName ="$fileId.${externalFile.extension}"// Save the file to the app's files directoryval appFile =FileKit.filesDir / fileName
// Write the file to the app's files directory
appFile write externalFile
// You can save the file name to a database or shared preferences// TODO saveInternalStorage(fileName)println("File saved to: ${appFile.absolutePath}")
return appFile
}
fungetSavedFile(): PlatformFile {
// Your implementation to read the file name from a database or shared preferencesval fileName = readInternalStorage()
// Recreate the file from the saved file namereturnFileKit.filesDir / fileName
}
Thank you. I did so. You announced working with the camera in the following issues. I would like to voice my wishes for working with the camera, if you do not mind. If possible, make it possible to record video, and switch the flash mode. That would be VERY good. Thank you.
Hello. I am testing version 0.10.0-SNAPSHOT. The absolutePath property returns the path without the file extension.
Tell me, do I understand correctly: this property can be transferred, for subsequent reading, to other modules?
The text was updated successfully, but these errors were encountered: