Fixed renamed file

This commit is contained in:
Pupil
2020-02-09 18:13:16 +09:00
parent e810abe33a
commit e551a40d08
5 changed files with 28 additions and 8 deletions

View File

@@ -146,7 +146,12 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
}
CoroutineScope(Dispatchers.IO).launch io@{
val target = getDownloadDirectory(context)?.createFile("null", "Pupil.apk")!!
val target = getDownloadDirectory(context).let {
if (it.findFile("Pupil.apk") != null)
it
else
it.createFile("null", "Pupil.apk")!!
}
try {
URL(url).download(context, target) { progress, fileSize ->