mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-07 14:27:56 +03:00
Android: Remove playlist migration logic
It malfunctioned when the game ZIP contained playlist.txt. Fixes #36.
This commit is contained in:
@@ -46,7 +46,6 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
companion object {
|
||||
const val TITLE_FILE = "title.txt"
|
||||
const val PLAYLIST_FILE = "playlist2.txt"
|
||||
const val OLD_PLAYLIST_FILE = "playlist.txt"
|
||||
|
||||
fun getInstance(rootDir: File): Launcher {
|
||||
if (gLauncher == null) {
|
||||
@@ -118,7 +117,6 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
val titleFile = File(path, TITLE_FILE)
|
||||
val title = titleFile.readText()
|
||||
games.add(Entry(path, title, titleFile.lastModified()))
|
||||
migratePlaylist(path)
|
||||
} catch (e: IOException) {
|
||||
// Incomplete game installation. Delete it.
|
||||
path.deleteRecursively()
|
||||
@@ -198,20 +196,6 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
configWriter.write(outDir)
|
||||
}
|
||||
|
||||
// System3-sdl2 <=0.7.0 had a bug where playlist had an extra empty line at
|
||||
// the beginning of the file. This migrates playlist.txt created by an old
|
||||
// version of system3-sdl2 to playlist2.txt.
|
||||
private fun migratePlaylist(dir: File) {
|
||||
val oldPlaylist = File(dir, OLD_PLAYLIST_FILE)
|
||||
if (!oldPlaylist.exists())
|
||||
return
|
||||
var tracks = oldPlaylist.readLines()
|
||||
if (tracks.isNotEmpty())
|
||||
tracks = tracks.subList(1, tracks.size)
|
||||
File(dir, PLAYLIST_FILE).writeText(tracks.joinToString("\n"))
|
||||
oldPlaylist.delete()
|
||||
}
|
||||
|
||||
class InstallFailureException(val msgId: Int) : Exception()
|
||||
|
||||
// A helper class which generates playlist.txt in the game root directory.
|
||||
|
||||
Reference in New Issue
Block a user