Skip to content

Commit

Permalink
Create parent directory for settings (#99)
Browse files Browse the repository at this point in the history
Fixes #98
  • Loading branch information
StefanLobbenmeier authored Nov 10, 2024
1 parent c300756 commit a3b1027
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package de.lobbenmeier.stefan.settings.business
import de.lobbenmeier.stefan.common.business.SettingsJson
import de.lobbenmeier.stefan.updater.business.platform
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlin.io.path.createParentDirectories
import kotlin.io.path.exists
import kotlin.io.path.readText
import kotlin.io.path.writeText
Expand Down Expand Up @@ -31,6 +32,7 @@ class SettingsViewModel {

fun saveSettings(settings: Settings) {
val settingsJson = SettingsJson.encodeToString(settings)
settingsFile.createParentDirectories()
settingsFile.writeText(settingsJson)

_settings.value = settings
Expand Down

0 comments on commit a3b1027

Please sign in to comment.