Browse Source

Added suppot for config file on Windows systems.

pull/2/head 1.2.2
Richard Neumann 4 years ago
parent
commit
531a7acac7
  1. 8
      rcon/config.py

8
rcon/config.py

@ -3,6 +3,7 @@
from __future__ import annotations
from configparser import ConfigParser, SectionProxy
from logging import getLogger
from os import getenv, name
from pathlib import Path
from typing import Dict, Iterator, NamedTuple, Tuple
@ -13,7 +14,14 @@ __all__ = ['CONFIG_FILE', 'LOG_FORMAT', 'Config', 'servers']
CONFIG = ConfigParser()
if name == 'posix':
CONFIG_FILE = Path('/etc/rcon.conf')
elif name == 'nt':
CONFIG_FILE = Path(getenv('LOCALAPPDATA')).joinpath('rcon.conf')
else:
raise NotImplementedError(f'Unsupported operating system: {name}')
LOG_FORMAT = '[%(levelname)s] %(name)s: %(message)s'
LOGGER = getLogger('RCON Config')

Loading…
Cancel
Save