add default for data-directory, don't try to make data dir
This commit is contained in:
parent
bf9fadec77
commit
c5e8a8e6f1
1 changed files with 1 additions and 3 deletions
4
bitbotd
4
bitbotd
|
@ -49,14 +49,12 @@ if args.version:
|
||||||
config = Config.Config(args.config)
|
config = Config.Config(args.config)
|
||||||
config.load()
|
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)
|
LOG_DIR = config.get("log-directory", "{DATA}/logs/").format(DATA=DATA_DIR)
|
||||||
DATABASE = config.get("database", "sqlite3:{DATA}/bot.db").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)
|
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)
|
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):
|
if not os.path.isdir(LOG_DIR):
|
||||||
os.mkdir(LOG_DIR)
|
os.mkdir(LOG_DIR)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue