|
@@ -220,12 +220,11 @@ interface JsExtensions : JsEncodeUtils {
|
|
|
val analyzeUrl = AnalyzeUrl(url, source = getSource())
|
|
val analyzeUrl = AnalyzeUrl(url, source = getSource())
|
|
|
val type = analyzeUrl.type ?: "zip"
|
|
val type = analyzeUrl.type ?: "zip"
|
|
|
val path = FileUtils.getPath(
|
|
val path = FileUtils.getPath(
|
|
|
- FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
|
|
|
|
|
|
|
+ File(FileUtils.getCachePath()),
|
|
|
"${MD5Utils.md5Encode16(url)}.${type}"
|
|
"${MD5Utils.md5Encode16(url)}.${type}"
|
|
|
)
|
|
)
|
|
|
- FileUtils.delete(path)
|
|
|
|
|
|
|
+ val file = File(path).createFileReplace()
|
|
|
analyzeUrl.getInputStream().use { iStream ->
|
|
analyzeUrl.getInputStream().use { iStream ->
|
|
|
- val file = FileUtils.createFileIfNotExist(path)
|
|
|
|
|
FileOutputStream(file).use { oStream ->
|
|
FileOutputStream(file).use { oStream ->
|
|
|
iStream.copyTo(oStream)
|
|
iStream.copyTo(oStream)
|
|
|
}
|
|
}
|
|
@@ -246,8 +245,8 @@ interface JsExtensions : JsEncodeUtils {
|
|
|
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
|
|
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
|
|
|
"${MD5Utils.md5Encode16(url)}.${type}"
|
|
"${MD5Utils.md5Encode16(url)}.${type}"
|
|
|
)
|
|
)
|
|
|
- FileUtils.delete(path)
|
|
|
|
|
- val file = FileUtils.createFileIfNotExist(path)
|
|
|
|
|
|
|
+ val file = File(path)
|
|
|
|
|
+ file.createFileReplace()
|
|
|
HexUtil.decodeHex(content).let {
|
|
HexUtil.decodeHex(content).let {
|
|
|
if (it.isNotEmpty()) {
|
|
if (it.isNotEmpty()) {
|
|
|
file.writeBytes(it)
|
|
file.writeBytes(it)
|
|
@@ -492,9 +491,8 @@ interface JsExtensions : JsEncodeUtils {
|
|
|
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
|
|
FileUtils.createFolderIfNotExist(FileUtils.getCachePath()),
|
|
|
FileUtils.getNameExcludeExtension(zipPath)
|
|
FileUtils.getNameExcludeExtension(zipPath)
|
|
|
)
|
|
)
|
|
|
- FileUtils.delete(unzipPath)
|
|
|
|
|
|
|
+ val unzipFolder = File(unzipPath).createFolderReplace()
|
|
|
val zipFile = getFile(zipPath)
|
|
val zipFile = getFile(zipPath)
|
|
|
- val unzipFolder = FileUtils.createFolderIfNotExist(unzipPath)
|
|
|
|
|
ZipUtils.unzipFile(zipFile, unzipFolder)
|
|
ZipUtils.unzipFile(zipFile, unzipFolder)
|
|
|
FileUtils.delete(zipFile.absolutePath)
|
|
FileUtils.delete(zipFile.absolutePath)
|
|
|
return unzipPath.substring(FileUtils.getCachePath().length)
|
|
return unzipPath.substring(FileUtils.getCachePath().length)
|