diff options
author | nicolargo <nicolas@nicolargo.com> | 2021-07-04 09:48:58 +0200 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2021-07-04 09:48:58 +0200 |
commit | 2e1b55e3e9fb28fa6a12077cc8fbbad28965d64e (patch) | |
tree | a5e5f53a4b0a44c688c8d249ddbf267e3e936e69 /glances | |
parent | 4c8b6d7f0efa8f04a5ba994bbd0cb1e36a55ea97 (diff) | |
parent | 03db71ce1082682bb4a2a9e331d5ee9cb7e025a7 (diff) |
Also search glances.conf file in /usr/share/doc/glances/glances.conf #1862
Diffstat (limited to 'glances')
-rw-r--r-- | glances/config.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/glances/config.py b/glances/config.py index 98212d3a..c4b9eff2 100644 --- a/glances/config.py +++ b/glances/config.py @@ -91,6 +91,24 @@ def system_config_dir(): return path +def default_config_dir(): + r"""Return the system-wide config dir (full path). + + - Linux, SunOS, *BSD, macOS: /usr/share/doc (as defined in the setup.py files) + - Windows: %APPDATA%\glances + """ + if LINUX or SUNOS or BDS or MACOS: + path = '/usr/share/doc' + else: + path = os.environ.get('APPDATA') + if path is None: + path = '' + else: + path = os.path.join(path, 'glances') + + return path + + class Config(object): """This class is used to access/read config file, if it exists. @@ -129,6 +147,7 @@ class Config(object): * /path/to/file (via -C flag) * user's home directory (per-user settings) * system-wide directory (system-wide settings) + * default pip directory (as defined in the setup.py file) """ paths = [] @@ -137,6 +156,7 @@ class Config(object): paths.append(os.path.join(user_config_dir(), self.config_filename)) paths.append(os.path.join(system_config_dir(), self.config_filename)) + paths.append(os.path.join(default_config_dir(), self.config_filename)) return paths |