-
Notifications
You must be signed in to change notification settings - Fork 76
Description
The paths here are incorrect:
https://github.com/containers/container-libs/blob/main/storage/pkg/homedir/homedir_windows.go
The correct paths are:
Cache: https://pkg.go.dev/os#UserCacheDir or %LOCALAPPDATA%
Config: https://pkg.go.dev/os#UserConfigDir or %APPDATA%
The only time https://pkg.go.dev/os#UserHomeDir or %USERPROFILE% should be used on Windows is if the user is prompted with a save dialog box and you want to set the default location they are looking at. That directory is meant for user created files, not application configuration.
Anything in UserConfigDir should be assumed to be automatically backed up remotely, so it shouldn't contain large files.
When writing to Cache or Config directories, a folder for the application in question should be created as a subdirectory. You should not be writing loose files to any of these directories, nor should you be writing generically named folders to any of these directories.
The hardest part of fixing this is backward compatibility. Easiest solution is to check to see if the old location exists first, and if so use that and if not use the new correct location. Alternatively, you could migrate on startup, which would allow you to eventually delete the code for checking the old improper location.