]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/directories/directories.factor
http.download: fix downloading into a directory if it didnt exist
[factor.git] / basis / io / directories / directories.factor
index 5b30462c112f5f34458ccbb0b747574a37dfad65..6017361f9d5a662ffb8d12480dbd6f77aebaa9e5 100644 (file)
@@ -215,8 +215,13 @@ HOOK: delete-directory io-backend ( path -- )
 
 HOOK: move-file io-backend ( from to -- )
 
+: create-parent-directory ( path -- )
+    normalize-path parent-directory make-directories ;
+
 : ?move-file ( from to -- )
-    over file-exists? [ move-file ] [ 2drop ] if ;
+    over file-exists? [
+        dup create-parent-directory move-file
+    ] [ 2drop ] if ;
 
 HOOK: move-file-atomically io-backend ( from to -- )