From 8ceaf795d891b75fead6893c8efe8d999b7ff551 Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Sun, 14 Mar 2021 11:01:39 +0300
Subject: project.boost.download: create missing directories

---
 project/boost/download.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'project/boost')

diff --git a/project/boost/download.py b/project/boost/download.py
index ca113a6..a065dab 100644
--- a/project/boost/download.py
+++ b/project/boost/download.py
@@ -26,7 +26,7 @@ import urllib.request
 
 from project.boost.archive import Archive, PermanentStorage, TemporaryStorage
 from project.boost.version import Version
-from project.utils import normalize_path, retry, setup_logging
+from project.utils import normalize_path, mkdir_parent, retry, setup_logging
 
 
 @retry(urllib.request.URLError)
@@ -76,11 +76,17 @@ class DownloadParameters:
             else:
                 unpack_dir = cache_dir
 
-        self.version = version
-        self.unpack_dir = normalize_path(unpack_dir)
-        self.storage = TemporaryStorage(unpack_dir)
+        unpack_dir = normalize_path(unpack_dir)
+        mkdir_parent(unpack_dir)
         if cache_dir is not None:
             cache_dir = normalize_path(cache_dir)
+            mkdir_parent(cache_dir)
+
+        self.version = version
+        self.unpack_dir = unpack_dir
+        if cache_dir is None:
+            self.storage = TemporaryStorage(unpack_dir)
+        else:
             self.storage = PermanentStorage(cache_dir)
         self.dest_path = dest_path
 
-- 
cgit v1.2.3