From 5b2e63e6b087bdf626dd7cef319d6ba29f5e197c Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 26 Feb 2024 17:47:46 -0300 Subject: fix(fs): make copy_contents behavior consistent on Unix Make it match the win32 behavior. --- src/luarocks/fs/unix/tools.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 42e22060..efd4d624 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua @@ -81,7 +81,10 @@ end -- plus an error message. function tools.copy_contents(src, dest) assert(src and dest) - if fs.execute_quiet(vars.CP.." -pPR "..fs.Q(src).."/* "..fs.Q(dest)) then + if not fs.is_dir(src) then + return false, src .. " is not a directory" + end + if fs.make_dir(dest) and fs.execute_quiet(vars.CP.." -pPR "..fs.Q(src).."/* "..fs.Q(dest)) then return true else return false, "Failed copying "..src.." to "..dest -- cgit v1.2.3-55-g6feb