Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Nov 9, 2024
1 parent db13096 commit 1d0b302
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 9 deletions.
14 changes: 9 additions & 5 deletions core/src/main/kotlin/com/github/zly2006/xbackup/XBackup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import org.slf4j.LoggerFactory
import org.sqlite.SQLiteConfig
import org.sqlite.SQLiteDataSource
import kotlin.coroutines.CoroutineContext
import kotlin.io.path.Path
import kotlin.io.path.absolute
import kotlin.io.path.readText
import kotlin.io.path.writeText
import kotlin.io.path.*

object XBackup : ModInitializer {
lateinit var config: Config
Expand Down Expand Up @@ -51,7 +48,14 @@ object XBackup : ModInitializer {
}

override fun onInitialize() {
loadConfig()
runCatching {
if (configPath.exists())
loadConfig()
else {
config = Config()
saveConfig()
}
}
if (System.getProperty("xb.restart") == "true") {
when (Util.getOperatingSystem()) {
Util.OperatingSystem.OSX, Util.OperatingSystem.LINUX -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ kotlin {
}

dependencies {
api(project(":core", configuration = "namedElements"))
shadow("com.google.guava:guava:31.1-jre")
shadow("com.azure:azure-identity:1.10.4")
shadow("com.microsoft.graph:microsoft-graph:5.75.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class OnedriveUtils : IOnedriveUtils {

val clientId = properties.getProperty("app.clientId")
val tenantId = properties.getProperty("app.tenantId")
val graphUserScopes = scopes

val authenticationRecordPath = "path/to/authentication-record.json"
Path(authenticationRecordPath).createParentDirectories()
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ include("xb-1.20")
include("xb-1.20.1")
include("xb-1.18")
include("core")
include("xb-onedrive")
include("onedrive-support")
24 changes: 24 additions & 0 deletions xb-1.18/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"schemaVersion": 1,
"id": "x_backup_${mc}",
"version": "${version}+${mc}",
"name": "X backup",
"description": "",
"authors": [],
"contact": {},
"license": "AGPL-3.0",
"icon": "assets/x_backup/icon.png",
"environment": "*",
"entrypoints": {
"main": [
]
},
"depends": {
"fabricloader": "*",
"fabric-language-kotlin": "*",
"minecraft": [
"1.18.1",
"1.18.2"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package com.github.zly2006.xbackup.mc120
import com.github.zly2006.xbackup.Commands
import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback
import org.jetbrains.exposed.sql.Database

object XB120: ModInitializer {
override fun onInitialize() {
Database.connect("jdbc:sqlite:file:worlds.db?mode=memory&cache=shared")
CommandRegistrationCallback.EVENT.register { dispatcher, _, _ ->
Commands.register(dispatcher)
}
Expand Down

0 comments on commit 1d0b302

Please sign in to comment.