aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-06-01 15:23:32 +0200
committernea <nea@nea.moe>2023-06-01 15:23:44 +0200
commitc969074af3ba24f7304cf78ab9fb95eb52743ba9 (patch)
treec2468c592ac731865dddea02d8866724e4863106 /src
parent635dbebbf46e76343260f0e659e8a9d84975eefd (diff)
downloadfirmament-c969074af3ba24f7304cf78ab9fb95eb52743ba9.tar.gz
firmament-c969074af3ba24f7304cf78ab9fb95eb52743ba9.tar.bz2
firmament-c969074af3ba24f7304cf78ab9fb95eb52743ba9.zip
Fix crash in auto reload when using outside a devenv
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/debug/DeveloperFeatures.kt7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/debug/DeveloperFeatures.kt b/src/main/kotlin/moe/nea/firmament/features/debug/DeveloperFeatures.kt
index ff69cd1..e4774f2 100644
--- a/src/main/kotlin/moe/nea/firmament/features/debug/DeveloperFeatures.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/debug/DeveloperFeatures.kt
@@ -22,11 +22,10 @@ object DeveloperFeatures : FirmamentFeature {
override val defaultEnabled: Boolean
get() = false
- val gradleDir by lazy {
+ val gradleDir =
Path.of(".").absolute()
.iterate { it.parent }
- .find { it.resolve("settings.gradle.kts").exists() }!!
- }
+ .find { it.resolve("settings.gradle.kts").exists() }
object TConfig : ManagedConfig("developer") {
val autoRebuildResources by toggle("auto-rebuild") { false }
@@ -34,7 +33,7 @@ object DeveloperFeatures : FirmamentFeature {
@JvmStatic
fun hookOnBeforeResourceReload(client: MinecraftClient): CompletableFuture<Void> {
- val reloadFuture = if (TConfig.autoRebuildResources && isEnabled) {
+ val reloadFuture = if (TConfig.autoRebuildResources && isEnabled && gradleDir != null) {
val builder = ProcessBuilder("./gradlew", ":processResources")
builder.directory(gradleDir.toFile())
builder.inheritIO()