Colton Idle
03/11/2025, 3:23 PMColton Idle
03/11/2025, 3:26 PMfun getAppDataDirectory(): Path {
val userHome = System.getProperty("user.home")
val appDataPath = when {
// Windows
System.getProperty("os.name").contains("Windows") -> {
Paths.get(System.getenv("APPDATA"), APP_NAME)
}
// macOS
System.getProperty("os.name").contains("Mac") -> {
Paths.get(userHome, "Library", "Application Support", APP_NAME)
}
// Linux and others
else -> {
Paths.get(userHome, ".config", APP_NAME)
}
}
// Create directories if they don't exist
if (!Files.exists(appDataPath)) {
Files.createDirectories(appDataPath)
}
return appDataPath
}
but it didn't seem to resolve the problem so I'm not sure if it's mostly right or if it's completely off. Surely writing a file for my app to use is something fairly straight forward right?
I think my biggest issue with this (and maybe this is just desktop development), how can I make sure I find these issue during development time instead of after shipping?Michael Paus
03/11/2025, 3:39 PMColton Idle
03/11/2025, 3:41 PMwhy do you use Java file IO?
Colton Idle
03/11/2025, 3:41 PMColton Idle
03/11/2025, 3:42 PMColton Idle
03/11/2025, 3:52 PMSergey Y.
03/11/2025, 3:54 PMColton Idle
03/11/2025, 6:09 PMmikehearn
03/12/2025, 10:23 AMColton Idle
03/12/2025, 3:54 PMmikehearn
03/12/2025, 4:09 PMColton Idle
03/12/2025, 4:12 PMColton Idle
03/12/2025, 4:12 PMMichael Paus
03/12/2025, 6:25 PM~/.MyApp/
the various operating systems actually have defined there specific folders to store such data and they often even make distinctions between different kinds of data. For example there may be different folders for cached and non-cached data. This library provides some documentation about this. When you go to iOS or Android things are getting even more complicated.mikehearn
03/12/2025, 6:28 PMMichael Paus
03/12/2025, 6:34 PM