package com.adealink.weparty.util

import com.adealink.frame.oss.data.UploadFile
import com.adealink.frame.storage.file.imageProgressPath
import com.adealink.frame.util.getFileSuffix
import com.adealink.frame.util.md5
import java.io.File

fun String?.getFilePathBy(path: String, fileType: UploadFile.FileType): String? {
    if (isNullOrEmpty()) {
        return null
    }
    return File(
        imageProgressPath,
        "${md5()}.${fileType.suffix.ifEmpty { getFileSuffix(this) }}"
    ).path
}
