Dont put preferences in the root of all apps preferences

This commit is contained in:
Syer10
2021-05-28 18:40:34 -04:00
parent 181c92a735
commit 41eb506622

View File

@@ -11,12 +11,14 @@ import com.russhwolf.settings.JvmPreferencesSettings
import java.util.prefs.Preferences
class PreferenceStoreFactory {
private val rootNode: Preferences = Preferences.userRoot()
.node("ca/gosyer/tachideskjui")
fun create(vararg names: String): PreferenceStore {
var preferences: Preferences = Preferences.userRoot()
names.forEach {
preferences = preferences.node(it)
}
return JvmPreferenceStore(JvmPreferencesSettings(preferences))
return JvmPreferenceStore(
JvmPreferencesSettings(
rootNode.node(names.joinToString(separator = "/"))
)
)
}
}