mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-30 12:43:24 +03:00
Also search glances.conf file in /usr/share/doc/glances/glances.conf #1862
This commit is contained in:
commit
2e1b55e3e9
@ -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
|
||||
==================== =============================================================
|
||||
|
||||
|
@ -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{
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user