vikstrous / pirate-get

A command line interface for The Pirate Bay
GNU Affero General Public License v3.0
337 stars 53 forks source link

Respect XDG_CONFIG_HOME if it is set #35

Closed pedromaltez closed 9 years ago

pedromaltez commented 9 years ago

The changes here are trivial at best but I thought that it would be a good idea to fully support the XDG Base Directory Specification and therefore recognise when the system has set the $XDG_CONFIG_HOME environment variable. The codebase was already leaning that way by setting the configuration file location to ~/.config/pirate-get/pirate.cfg, this patch allows the path to be $XDG_CONFIG_HOME/pirate-get/pirate.cfg if it exists, otherwise it falls back to the original.

If this is something you'd like but there's something wrong with the way I'm implementing it, then please let me know and I'll try to fix it. I wasn't sure where to put the config_to_load() function, or what to name it, really.

vikstrous commented 9 years ago

Cool. Thanks. There's no official style. There are just a lot of hacks on top of hacks by random people. I'm merging anything as long as it works. Maybe one day I'll go through it and clean it up, but there hasn't really been a need for that yet.