Fix: Cannot store loaded profiles
This commit is contained in:
@ -3,6 +3,7 @@ package io.neoterm.component.profile
|
|||||||
import io.neolang.visitor.ConfigVisitor
|
import io.neolang.visitor.ConfigVisitor
|
||||||
import io.neoterm.frontend.component.helper.ConfigFileBasedComponent
|
import io.neoterm.frontend.component.helper.ConfigFileBasedComponent
|
||||||
import io.neoterm.frontend.config.NeoTermPath
|
import io.neoterm.frontend.config.NeoTermPath
|
||||||
|
import io.neoterm.frontend.logging.NLog
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +28,7 @@ class ProfileComponent : ConfigFileBasedComponent<NeoProfile>(NeoTermPath.PROFIL
|
|||||||
.singleOrNull()
|
.singleOrNull()
|
||||||
|
|
||||||
if (profileClass != null) {
|
if (profileClass != null) {
|
||||||
|
NLog.e("ProfileComponent", "Loaded profile: " + profileClass.name)
|
||||||
return profileClass.newInstance()
|
return profileClass.newInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,18 +45,19 @@ class ProfileComponent : ConfigFileBasedComponent<NeoProfile>(NeoTermPath.PROFIL
|
|||||||
this.loadConfigure(it)
|
this.loadConfigure(it)
|
||||||
}
|
}
|
||||||
.forEach {
|
.forEach {
|
||||||
val list = profileList[it.profileName]
|
val list = profileList[it.profileMetaName]
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
list.add(it)
|
list.add(it)
|
||||||
} else {
|
} else {
|
||||||
val newList = mutableListOf(it)
|
val newList = mutableListOf(it)
|
||||||
profileList.put(it.profileName, newList)
|
profileList.put(it.profileMetaName, newList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerProfile(metaName: String, prototype: Class<out NeoProfile>) {
|
fun registerProfile(metaName: String, prototype: Class<out NeoProfile>) {
|
||||||
profileRegistry[metaName] = prototype
|
profileRegistry[metaName] = prototype
|
||||||
|
reloadProfiles()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unregisterProfile(metaName: String) {
|
fun unregisterProfile(metaName: String) {
|
||||||
|
Reference in New Issue
Block a user