changeset 188:0abd24ab81b1

core: retrieve downloads_dir on startup
author Goffi <goffi@goffi.org>
date Tue, 22 May 2018 19:25:23 +0200
parents d11df7793399
children a91abcd6d9a5
files cagou/core/cagou_main.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Tue May 22 19:25:20 2018 +0200
+++ b/cagou/core/cagou_main.py	Tue May 22 19:25:23 2018 +0200
@@ -352,6 +352,12 @@
         self.app = CagouApp()
         self.app.host = self
         self.media_dir = self.app.media_dir = config.getConfig(main_config, '', 'media_dir')
+        self.downloads_dir = self.app.downloads_dir = config.getConfig(main_config, '', 'downloads_dir')
+        if not os.path.exists(self.downloads_dir):
+            try:
+                os.makedirs(self.downloads_dir)
+            except OSError as e:
+                log.warnings(_(u"Can't create downloads dir: {reason}").format(reason=e))
         self.app.default_avatar = os.path.join(self.media_dir, "misc/default_avatar.png")
         self.app.icon = os.path.join(self.media_dir, "icons/muchoslava/png/cagou_profil_bleu_96.png")
         self._plg_wids = []  # main widgets plugins