fix some Rename related glitches

This commit is contained in:
tibbi 2018-04-22 23:08:36 +02:00
parent 302a7842c4
commit 8ff9e7f6ad
2 changed files with 5 additions and 2 deletions

View file

@ -148,9 +148,12 @@ fun BaseSimpleActivity.toggleFileVisibility(oldPath: String, hide: Boolean, call
filename.substring(1, filename.length)
}
val newPath = "$path$filename"
val newPath = "$path/$filename"
renameFile(oldPath, newPath) {
callback?.invoke(newPath)
Thread {
updateMediaPath(oldPath, newPath)
}.start()
}
}

View file

@ -23,6 +23,6 @@ interface MediumDao {
@Query("DELETE FROM media WHERE full_path = :path")
fun deleteMediumPath(path: String)
@Query("UPDATE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath")
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath")
fun updateMedia(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String)
}