Commit 9eaffe13 authored by mathieui's avatar mathieui

Fix the os.makedirs calls so that they don’t traceback for nothing

parent 9b8ed569
......@@ -243,7 +243,7 @@ if not CONFIG_HOME:
CONFIG_PATH = path.join(CONFIG_HOME, 'poezio')
try:
makedirs(CONFIG_PATH)
makedirs(CONFIG_PATH, exist_ok=True)
except OSError:
pass
......
......@@ -56,14 +56,17 @@ class Logger(object):
return
directory = os.path.join(DATA_HOME, 'logs')
try:
makedirs(directory)
makedirs(directory, exist_ok=True)
except OSError:
pass
import traceback
log.debug('Cannot create log directory "%s":\n%s', directory, traceback.format_exc())
try:
fd = open(os.path.join(directory, room), 'a')
self.fds[room] = fd
return fd
except IOError:
import traceback
log.debug('Cannot open logfile %s:\n%s', room, traceback.format_exc())
return
def get_logs(self, jid, nb=10):
......
......@@ -38,14 +38,14 @@ if not plugins_conf_dir:
plugins_conf_dir = os.path.expanduser(plugins_conf_dir)
try:
os.makedirs(plugins_dir)
os.makedirs(plugins_dir, exist_ok=True)
except OSError:
pass
else:
load_path.append(plugins_dir)
try:
os.makedirs(plugins_conf_dir)
os.makedirs(plugins_conf_dir, exist_ok=True)
except OSError:
pass
......
......@@ -372,7 +372,7 @@ def reload_theme():
'poezio', 'themes')
themes_dir = os.path.expanduser(themes_dir)
try:
os.makedirs(themes_dir)
os.makedirs(themes_dir, exist_ok=True)
except OSError:
pass
theme_name = config.get('theme', 'default')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment