Commit a8de05b
authored
Set config directory according to runtime platform
This commit changes the definition of the persistent state and
configuration files (`SOCO_CLI_DIR`) to derive from the output of
[platform.system()][1], rather than being fixed to an eponymous,
dot-prefixed directory in the top level of the user's `$HOME`.
Furthermore, on POSIX-compliant platforms it tests for the
presence of the XDG_CONFIG_HOME environment variable and
establishes the config directory there, with a fallback to the
`$HOME/.config` directory as defined in the [XDG Base Directory Specification][2].
On Microsoft Windows® systems, it places the directory inside
the path defined by the `%LOCALAPPDATA%` environment
variable, which is the vendor-specified path for all machine-
specific application data belonging to the active user.
On all other platforms the former behavior is retained. Several
individual definitions of this path were consolidated into the
`SOCO_CLI_DIR` constant already present in the file, which itself was relocated along with the attendant `_confirm_soco_cli_dir` method earlier in the file, nearer to the other defined constants.
1: https://docs.python.org/3/library/platform.html#platform.system
2: https://specifications.freedesktop.org/basedir-spec/latest/index.html1 parent a75b427 commit a8de05b
1 file changed
Lines changed: 39 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
38 | 60 | | |
39 | 61 | | |
40 | 62 | | |
| |||
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
229 | | - | |
| 251 | + | |
230 | 252 | | |
231 | 253 | | |
232 | 254 | | |
| |||
712 | 734 | | |
713 | 735 | | |
714 | 736 | | |
715 | | - | |
716 | | - | |
717 | | - | |
| 737 | + | |
718 | 738 | | |
719 | 739 | | |
720 | 740 | | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
726 | 749 | | |
727 | 750 | | |
728 | 751 | | |
729 | 752 | | |
730 | | - | |
731 | | - | |
| 753 | + | |
| 754 | + | |
732 | 755 | | |
733 | | - | |
| 756 | + | |
734 | 757 | | |
735 | 758 | | |
736 | 759 | | |
737 | 760 | | |
738 | 761 | | |
739 | 762 | | |
740 | | - | |
741 | | - | |
| 763 | + | |
742 | 764 | | |
743 | 765 | | |
744 | 766 | | |
745 | | - | |
746 | | - | |
| 767 | + | |
| 768 | + | |
747 | 769 | | |
748 | 770 | | |
749 | 771 | | |
| |||
765 | 787 | | |
766 | 788 | | |
767 | 789 | | |
768 | | - | |
769 | 790 | | |
770 | 791 | | |
771 | 792 | | |
| |||
846 | 867 | | |
847 | 868 | | |
848 | 869 | | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | 870 | | |
861 | 871 | | |
862 | 872 | | |
| |||
0 commit comments