refactor(file): download 方法复用 resolveBaseDir,统一目录创建逻辑
这个提交包含在:
父节点
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
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户