add default for data-directory, don't try to make data dir

This commit is contained in:
jesopo 2019-12-20 21:58:34 +00:00
parent bf9fadec77
commit c5e8a8e6f1

View file

@ -49,14 +49,12 @@ if args.version:
config = Config.Config(args.config)
config.load()
DATA_DIR = os.path.expanduser(config["data-directory"])
DATA_DIR = os.path.expanduser(config.get("data-directory", "~/.bitbot"))
LOG_DIR = config.get("log-directory", "{DATA}/logs/").format(DATA=DATA_DIR)
DATABASE = config.get("database", "sqlite3:{DATA}/bot.db").format(DATA=DATA_DIR)
LOCK_FILE = config.get("lock-file", "{DATA}/bot.lock").format(DATA=DATA_DIR)
SOCK_FILE = config.get("sock-file", "{DATA}/bot.sock").format(DATA=DATA_DIR)
if not os.path.isdir(DATA_DIR):
os.mkdir(DATA_DIR)
if not os.path.isdir(LOG_DIR):
os.mkdir(LOG_DIR)