Regression in 0.5.0 in escaping back slashes in strings
Wavesonics opened this issue · 2 comments
Wavesonics commented
Serializing a path in 0.4.0 correctly escapes \
but 0.5.0 some times does not get them all.
Here is an example of a failed serialization in 0.5.0:
projectsDirectory = "C:\Users\\foo\\bar"
uiTheme = "FollowSystem"
automaticBackups = true
autoCloseSyncDialog = false
maxBackups = 50
automaticSyncing = true
[nux]
exampleProjectCreated = true
See that projectsDirectory
doesn't have the first \
escaped. When you then try to deserialize it, for some reason I'm getting a NumberFormatException
? But what ever, the issue is that on serialization, it is missing the slash for escape.
This is the class being serialized:
@Serializable
data class GlobalSettings(
val projectsDirectory: String,
val uiTheme: UiTheme = UiTheme.FollowSystem,
val automaticBackups: Boolean = true,
val autoCloseSyncDialog: Boolean = true,
val maxBackups: Int = DEFAULT_MAX_BACKUPS,
val automaticSyncing: Boolean = true,
val nux: NewUserExperience = NewUserExperience()
) {
companion object {
const val DEFAULT_MAX_BACKUPS = 50
}
}
@Serializable
data class NewUserExperience(
val exampleProjectCreated: Boolean = false
)
enum class UiTheme {
Light,
Dark,
FollowSystem
}
orchestr7 commented
Thank you the report, bro! Looks like we have broken that code while were refactoring strings… Will be taken to 0.5.1
Wavesonics commented
Crap, I just ran into a very similar error in 0.4.0