Open superjamie opened 1 year ago
If you're willing to accept, I'm happy to send a PR. It looks like just changing:
def get_cache_file(self):
return os.path.join(GLib.get_user_cache_dir(), "magnus.json")
To use get_user_config_dir
instead:
def get_cache_file(self):
return os.path.join(GLib.get_user_config_dir(), "magnus.json")
Maybe that function could be renamed to get_config_file
too.
Thank you for your useful application. There's nothing quite like it. It's installed by default on many Linux distributions, so surely a great success too!
I hit the problem where the window could not be resized smaller and looked all through
~/.config
and~/.local
for the config file. Finally I landed on https://github.com/stuartlangridge/magnus/issues/10. From that discussion:Please allow me to offer an alternative opinion.
A "cache" holds an identical copy of something which could be computationally re-generated identically at greater cost. It's a time-saving measure. Your CPU holds data in its cache to prevent fetching it from (slower) main memory or (very slow) disk. The thumbnail cache holds a small version of every image to prevent reading and resizing every large image file.
The only cost to deleting a cache is that the computer will take a little longer to perform some actions, as it must do those actions from scratch. However, the end result of the actions is always the same. No matter how many times I delete the thumbnail cache, the same image will re-generate the same thumbnail.
A "configuration" is a persistent user settting which overrides built-in defaults. It's perfectly normal for a program to operate without a configuration file, then the built-in defaults are used. However, if the program reads a file from disk which overrides the defaults, then this is a configuration file. The fact that a configuration file is not "required" for the program to start does not turn the configuration file into ephemeral cache content.
The cost to deleting a configuration is that the user's customisation of the program is lost, and the user must re-generate their settings again manually. Maybe that's something very easy (like roughly resizing a Magnus window) or maybe that's a very large time investment with the falliable human likely to forget some things. Imagine deleting your preferred code editor's configuration file!
In this situation, Magnus is storing settings which are then applied at new launch, and which override the default settings. This is a configuration so should logically go in
~/.config
. Ideally it should actually go in$XDG_CONFIG_HOME
as per the XDG Base Specification.Please do consider changing the path. It would have saved me a lot of time to have the file in the expected location, and others on #10 by the sounds of it too.