Skip to content

Commit 9c362da

Browse files
committed
Make dir before symlink cache
1 parent 2090e95 commit 9c362da

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/monobase/pget.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def single_pget(url: str, dest: str, extract: bool, force: bool) -> None:
155155
os.unlink(dest)
156156

157157
if os.path.isdir(fpath):
158+
os.makedirs(dest, exist_ok=True)
158159
# Symlink all files, not directories in case user code writes into them
159160
# cp -rs <src>/. <dst> copies everything inside <src>, not itself
160161
subprocess.run(
@@ -170,6 +171,9 @@ def single_pget(url: str, dest: str, extract: bool, force: bool) -> None:
170171
os.unlink(tgt)
171172
shutil.copy(p, tgt)
172173
else:
174+
d = os.path.dirname(dest)
175+
if d != '':
176+
os.makedirs(d, exist_ok=True)
173177
os.symlink(fpath, dest)
174178
return
175179

0 commit comments

Comments
 (0)