[latex3-commits] [git/LaTeX3-latex3-l3build] main: Create directories before copying files into them (987dd5d)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Sep 14 18:56:30 CEST 2022


Repository : https://github.com/latex3/l3build
On branch  : main
Link       : https://github.com/latex3/l3build/commit/987dd5d7afe155536816d3909deddf2e0587ae8c

>---------------------------------------------------------------

commit 987dd5d7afe155536816d3909deddf2e0587ae8c
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Wed Sep 14 18:35:27 2022 +0200

    Create directories before copying files into them


>---------------------------------------------------------------

987dd5d7afe155536816d3909deddf2e0587ae8c
 l3build-install.lua | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/l3build-install.lua b/l3build-install.lua
index baea5a9..64d29fc 100644
--- a/l3build-install.lua
+++ b/l3build-install.lua
@@ -327,9 +327,17 @@ function install_files(target,full,dry_run)
 
   if errorlevel ~= 0 then return errorlevel end
 
+  -- Track created destination directories to avoid overhead from
+  -- repeatedly creating them
+  local destination_dirs = {}
+
   -- Files are all copied in one shot: this ensures that cleandir()
   -- can't be an issue even if there are complex set-ups
   for _,v in ipairs(installmap) do
+    if not destination_dirs[v.dest] then
+      mkdir(v.dest)
+      destination_dirs[v.dest] = true
+    end
     errorlevel = cp(v.file,v.source,v.dest)
     if errorlevel ~= 0  then return errorlevel end
   end





More information about the latex3-commits mailing list.