diff --git a/docs/config.rst b/docs/config.rst index c806ec9c..85872843 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -17,9 +17,9 @@ Location You can put your own ``glances.conf`` file in the following locations: ==================== ============================================================= -``Linux``, ``SunOS`` ~/.config/glances/glances.conf, /etc/glances/glances.conf -``*BSD`` ~/.config/glances/glances.conf, /usr/local/etc/glances/glances.conf -``macOS`` ~/Library/Application Support/glances/glances.conf, /usr/local/etc/glances/glances.conf +``Linux``, ``SunOS`` ~/.config/glances/, /etc/glances/, /usr/share/docs/glances/ +``*BSD`` ~/.config/glances/, /usr/local/etc/glances/, /usr/share/docs/glances/ +``macOS`` ~/Library/Application Support/glances/, /usr/local/etc/glances/, /usr/share/docs/glances/ ``Windows`` %APPDATA%\\glances\glances.conf ==================== ============================================================= diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 012cde27..1fd6bf68 100644 --- a/docs/man/glances.1 +++ b/docs/man/glances.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "GLANCES" "1" "Jul 03, 2021" "3.2.1_beta1" "Glances" +.TH "GLANCES" "1" "Jul 04, 2021" "3.2.1_beta1" "Glances" .SH NAME glances \- An eye on your system . @@ -523,19 +523,19 @@ _ T{ \fBLinux\fP, \fBSunOS\fP T} T{ -~/.config/glances/glances.conf, /etc/glances/glances.conf +~/.config/glances/, /etc/glances/, /usr/share/docs/glances/ T} _ T{ \fB*BSD\fP T} T{ -~/.config/glances/glances.conf, /usr/local/etc/glances/glances.conf +~/.config/glances/, /usr/local/etc/glances/, /usr/share/docs/glances/ T} _ T{ \fBmacOS\fP T} T{ -~/Library/Application Support/glances/glances.conf, /usr/local/etc/glances/glances.conf +~/Library/Application Support/glances/, /usr/local/etc/glances/, /usr/share/docs/glances/ T} _ T{ 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