-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The absolutePath property returns the path without the file extension. #172
Comments
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 Here is an example of how you can save and retrieve a file from the app filesDir directory: suspend fun saveFileToAppStorage(externalFile: PlatformFile): PlatformFile {
// Create a file name for the saved file
val fileId = Uuid.random().toString()
val fileName = "$fileId.${externalFile.extension}"
// Save the file to the app's files directory
val 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
}
fun getSavedFile(): PlatformFile {
// Your implementation to read the file name from a database or shared preferences
val fileName = readInternalStorage()
// Recreate the file from the saved file name
return FileKit.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. |
With FileKit version You can read the documentation here: https://filekit.mintlify.app/dialogs/camera-picker |
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: