From 5695de055fd3c3ad7f5a38f759a5afa8fae2634a Mon Sep 17 00:00:00 2001 From: Syer10 Date: Sat, 30 Mar 2024 21:16:22 -0400 Subject: [PATCH] Release v1.3.3 --- .github/ISSUE_TEMPLATE/bug_report.md | 6 ++-- build.gradle.kts | 2 +- buildSrc/src/main/kotlin/Config.kt | 2 +- .../ca/gosyer/jui/desktop/AppMigrations.kt | 28 +++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6c221daaa4..1ae09d76ee 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,12 +23,12 @@ Note that the issue will be automatically closed if you do not fill out the titl --- ## Device information -- Suwayomi-JUI version: (Example: v1.3.2) +- Suwayomi-JUI version: (Example: v1.3.3) - Operating System: (Example: Ubuntu 20.04) - Desktop Environment: (Example: Gnome 40) - Server Type: (Example: Internal) -- Client JVM version: (Example: Java 17.0.1 or JUI Installer) -- Server JVM version: (Example: Same as Client or OpenJDK 8u281) +- Client JVM version: (Example: Java 17.0.10 or JUI Installer) +- Server JVM version: (Example: Same as Client or OpenJDK 8u301) ## Steps to reproduce 1. First Step diff --git a/build.gradle.kts b/build.gradle.kts index 4218c34cc5..d5fcb3ce19 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,7 +28,7 @@ plugins { allprojects { group = "ca.gosyer" - version = "1.3.2" + version = "1.3.3" dependencies { modules { diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 2659bf1e02..4cc52d58c8 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -1,7 +1,7 @@ import org.gradle.api.JavaVersion object Config { - const val migrationCode = 4 + const val migrationCode = 5 // Suwayomi-Server version const val tachideskVersion = "v1.0.0" diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt index 380299bc7e..b71cd184c5 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt @@ -6,10 +6,14 @@ package ca.gosyer.jui.desktop +import ca.gosyer.appdirs.AppDirs import ca.gosyer.jui.desktop.build.BuildConfig import ca.gosyer.jui.domain.migration.service.MigrationPreferences import ca.gosyer.jui.uicore.vm.ContextWrapper import me.tatarka.inject.annotations.Inject +import okio.FileSystem +import okio.Path.Companion.toPath +import org.lighthousegames.logging.logging class AppMigrations @Inject @@ -17,6 +21,7 @@ class AppMigrations private val migrationPreferences: MigrationPreferences, private val contextWrapper: ContextWrapper, ) { + @Suppress("KotlinConstantConditions") fun runMigrations(): Boolean { val oldVersion = migrationPreferences.appVersion().get() if (oldVersion < BuildConfig.MIGRATION_CODE) { @@ -26,8 +31,31 @@ class AppMigrations if (oldVersion == 0) { return false } + + if (oldVersion < 5) { + val oldDir = AppDirs("Tachidesk-JUI").getUserDataDir().toPath() + val newDir = AppDirs("Suwayomi-JUI").getUserDataDir().toPath() + try { + FileSystem.SYSTEM.list(oldDir) + .filter { FileSystem.SYSTEM.metadata(it).isDirectory } + .forEach { path -> + runCatching { + FileSystem.SYSTEM.atomicMove(path, newDir / path.name) + }.onFailure { + log.e(it) { "Failed to move directory ${path.name}" } + } + } + } catch (e: Exception) { + log.e(e) { "Failed to run directory migration" } + } + } + return true } return false } + + companion object { + private val log = logging() + } }