Add root path setting

This commit is contained in:
Syer10
2024-04-03 00:17:15 -04:00
parent 92158dfa63
commit 86ba6bb9ef
4 changed files with 47 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ actual class ServerHostPreferences actual constructor(
) {
actual fun host(): Preference<Boolean> = preferenceStore.getBoolean("host", true)
// IP
private val ip = ServerHostPreference.IP(preferenceStore)
fun ip(): Preference<String> = ip.preference()
@@ -23,6 +24,11 @@ actual class ServerHostPreferences actual constructor(
fun port(): Preference<Int> = port.preference()
// Root
private val rootPath = ServerHostPreference.RootPath(preferenceStore)
fun rootPath(): Preference<String> = rootPath.preference()
// Downloader
private val downloadPath = ServerHostPreference.DownloadPath(preferenceStore)
@@ -55,6 +61,7 @@ actual class ServerHostPreferences actual constructor(
listOf(
ip,
port,
rootPath,
downloadPath,
backupPath,
localSourcePath,

View File

@@ -63,6 +63,15 @@ sealed class ServerHostPreference<T : Any> {
override fun preference(): Preference<Boolean> = preferenceStore.getBoolean(propertyName, defaultValue)
}
// Root
class RootPath(
preferenceStore: PreferenceStore,
) : StringServerHostPreference(
preferenceStore,
"rootDir",
"",
)
class IP(
preferenceStore: PreferenceStore,
) : StringServerHostPreference(