mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Change backup file names
We use the application ID now to ensure uniqueness if the same folder is selected between different app versions/forks. This will make more sense once storage settings are unified to a single location. Also changes the file extension while we're at it so people stop accidentally ungzipping it.
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
package eu.kanade.tachiyomi.data.backup.models
 | 
			
		||||
 | 
			
		||||
import eu.kanade.tachiyomi.BuildConfig
 | 
			
		||||
import kotlinx.serialization.Serializable
 | 
			
		||||
import kotlinx.serialization.protobuf.ProtoNumber
 | 
			
		||||
import java.text.SimpleDateFormat
 | 
			
		||||
@@ -16,11 +17,11 @@ data class Backup(
 | 
			
		||||
) {
 | 
			
		||||
 | 
			
		||||
    companion object {
 | 
			
		||||
        val filenameRegex = """tachiyomi_\d+-\d+-\d+_\d+-\d+.proto.gz""".toRegex()
 | 
			
		||||
        val filenameRegex = """${BuildConfig.APPLICATION_ID}_\d+-\d+-\d+_\d+-\d+.tachibk""".toRegex()
 | 
			
		||||
 | 
			
		||||
        fun getFilename(): String {
 | 
			
		||||
            val date = SimpleDateFormat("yyyy-MM-dd_HH-mm", Locale.getDefault()).format(Date())
 | 
			
		||||
            return "tachiyomi_$date.proto.gz"
 | 
			
		||||
            return "${BuildConfig.APPLICATION_ID}_$date.tachibk"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user