Marcin Wisniowski
08/21/2023, 12:19 PM/home/user/.config/myapp/1.2.3
), meaning every time users update my app, they would get a new config directory, and to prevent losing their config on every app update I would need some migration mechanism to copy files over from the previous version.
Looking on my system, most applications just use /home/user/.config/myapp/
without a version, which is what makes sense to me, but that use case is unsupported by the AppDirs library. I'm curious how others solve this problem?Carlton Whitehead
08/21/2023, 12:54 PMMarcin Wisniowski
08/21/2023, 3:59 PMMitchell Syer
08/21/2023, 7:28 PMMarcin Wisniowski
08/21/2023, 9:10 PMAbdelilah El Aissaoui
08/23/2023, 10:58 AMval xdgConfigHome: String? = System.getenv("XDG_CONFIG_HOME")
val settingsPath = if (xdgConfigHome.isNullOrBlank()) {
val home = System.getProperty("user.home").orEmpty()
"$home/.config/appName
} else {
"$xdgConfigHome/appName"
}
// If using the preferences API from java:
System.setProperty("java.util.prefs.userRoot", settingsPath)