[latex3-commits] [git/LaTeX3-latex3-l3build] mkdir: Create directories before copying files into them (2ed0d73)

Marcel Fabian Krüger tex at 2krueger.de
Wed Sep 14 18:35:27 CEST 2022


Repository : https://github.com/latex3/l3build
On branch  : mkdir
Link       : https://github.com/latex3/l3build/commit/2ed0d73ca0d88dadad75f17cd6370b58329e89f0

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

commit 2ed0d73ca0d88dadad75f17cd6370b58329e89f0
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


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

2ed0d73ca0d88dadad75f17cd6370b58329e89f0
 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.