Profile: Use file based features

This commit is contained in:
zt515 2017-12-26 23:41:30 +08:00
parent 91c816ca96
commit 72bfe2c784

View File

@ -16,6 +16,10 @@ import java.io.File
*/
class ProfileComponent : ConfigFileBasedComponent<NeoProfile>() {
override fun onCheckComponentFiles() {
val profileDir = File(NeoTermPath.PROFILE_PATH)
if (!profileDir.exists()) {
profileDir.mkdirs()
}
}
override fun onCreateComponentObject(configVisitor: ConfigVisitor): NeoProfile {
@ -42,22 +46,4 @@ class ProfileComponent : ConfigFileBasedComponent<NeoProfile>() {
fun unregisterProfile(metaName: String) {
profileRegistry.remove(metaName)
}
override fun onServiceInit() {
checkForFiles()
}
override fun onServiceDestroy() {
}
override fun onServiceObtained() {
checkForFiles()
}
private fun checkForFiles() {
val profileDir = File(NeoTermPath.PROFILE_PATH)
if (!profileDir.exists()) {
profileDir.mkdirs()
}
}
}