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

@@ -206,7 +206,12 @@ class Cache(context: Context) : ContextWrapper(context) {
if (!Regex("""^[0-9]+.+$""").matches(name))
throw IllegalArgumentException("File name is not a number")
cache.createFile("null", name)?.writeBytes(this, data)
cache.let {
if (it.findFile(name) != null)
it
else
it.createFile("null", name)
}?.writeBytes(this, data)
}
fun moveToDownload(galleryID: Int) {