提交 3a4d5179 编写于 作者: A Alessio Sergi

Add config file support under Windows [issue #288]

上级 3368beb5
......@@ -401,6 +401,7 @@ class Config:
* Linux: ~/.config/glances, /etc/glances
* BSD: ~/.config/glances, /usr/local/etc/glances
* Mac: ~/Library/Application Support/glances, /usr/local/etc/glances
* Windows: %APPDATA%\glances
The config file will be searched in the following order of priority:
* /path/to/file (via -C flag)
......@@ -425,6 +426,9 @@ class Config:
paths.append(os.path.join(
os.path.expanduser('~/Library/Application Support/'),
__appname__, self.filename))
elif is_Windows:
paths.append(os.path.join(
os.environ.get('APPDATA'), __appname__, self.filename))
if is_Linux:
paths.append(os.path.join('/etc', __appname__, self.filename))
......
......@@ -18,12 +18,14 @@ data_files = [
]
if hasattr(sys, 'real_prefix') or 'bsd' in sys.platform:
etc_path = os.path.join(sys.prefix, 'etc', 'glances')
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
if not hasattr(sys, 'real_prefix') and 'linux' in sys.platform:
etc_path = os.path.join('/etc', 'glances')
conf_path = os.path.join('/etc', 'glances')
elif 'darwin' in sys.platform:
etc_path = os.path.join('/usr/local', 'etc', 'glances')
data_files.append((etc_path, ['glances/conf/glances.conf']))
conf_path = os.path.join('/usr/local', 'etc', 'glances')
elif 'win32' in sys.platform:
conf_path = os.path.join(os.environ.get('APPDATA'), 'glances')
data_files.append((conf_path, ['glances/conf/glances.conf']))
for mo in glob.glob('i18n/*/LC_MESSAGES/*.mo'):
data_files.append((os.path.dirname(mo).replace('i18n/', 'share/locale/'), [mo]))
......@@ -32,7 +34,7 @@ if sys.platform.startswith('win'):
requires = ['psutil>=0.5.1', 'colorconsole==0.6']
else:
requires = ['psutil>=0.5.1']
setup(
name='Glances',
version='1.7.1',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册