refactor(file): download 方法复用 resolveBaseDir,统一目录创建逻辑

这个提交包含在:
XuqmGroup 2026-06-18 13:50:48 +08:00
父节点 a6b1905a66
当前提交 d2873eda66

查看文件

@ -165,13 +165,7 @@ object FileSDK {
?: "download.bin" ?: "download.bin"
val baseDir = when (destination) { val baseDir = when (destination) {
FileDownloadDestination.PublicDownloads -> { FileDownloadDestination.PublicDownloads -> resolveBaseDir(context, destination)
val appName = context.applicationInfo.loadLabel(context.packageManager).toString()
File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
appName,
).apply { mkdirs() }
}
FileDownloadDestination.Sandbox -> { FileDownloadDestination.Sandbox -> {
if (directoryName.isNullOrBlank()) { if (directoryName.isNullOrBlank()) {
context.getExternalFilesDir(null) ?: context.filesDir context.getExternalFilesDir(null) ?: context.filesDir