Fix filepath repo - android

This commit is contained in:
hasinarak3@gmail.com 2026-04-07 09:38:57 +03:00
parent e0b98c5758
commit 0c0cf4d43c
2 changed files with 7 additions and 5 deletions

View file

@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" /> android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application <application
android:name=".AndroidApp" android:name=".AndroidApp"
android:allowBackup="true" android:allowBackup="true"

View file

@ -66,11 +66,11 @@ class AndroidFileRepository(private val context: Context) : FileRepository {
} }
} }
/*override fun getFileName(shortName: String): String { /* Exwternal files */
override fun getFileName(shortName: String): String {
val folder = context.getExternalFilesDir(null) val folder = context.getExternalFilesDir(null)
return "$folder/$shortName" return "$folder/$shortName"
}*/ }
// Dans androidMain / AndroidFileRepository.kt
/*override suspend fun readFileBytes(filePath: String): ByteArray = withContext(Dispatchers.IO) { /*override suspend fun readFileBytes(filePath: String): ByteArray = withContext(Dispatchers.IO) {
val folder = context.getExternalFilesDir(null) val folder = context.getExternalFilesDir(null)
val file = File(folder, filePath) val file = File(folder, filePath)
@ -95,9 +95,10 @@ class AndroidFileRepository(private val context: Context) : FileRepository {
throw e throw e
} }
} }
override fun getFileName(shortName: String): String { // Internal files
/*override fun getFileName(shortName: String): String {
return File(context.filesDir, shortName).absolutePath return File(context.filesDir, shortName).absolutePath
} }*/
override fun pickSavePath(defaultName: String): String? { override fun pickSavePath(defaultName: String): String? {
val downloadDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) val downloadDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)