From 3a2a49d508d19ef5548e6c0487c239856fc4f70a Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Fri, 15 Nov 2013 18:03:41 +0100 Subject: [PATCH] e2lib.cp: change flags to recursive and use an argv Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 17 ++++++++++------- plugins/svn.lua | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index ee05542..c900ce1 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1867,18 +1867,21 @@ function e2lib.mv(src, dst) return e2lib.call_tool_argv("mv", { src, dst }) end ---- call the cp command +--- Call the cp command. -- @param src string: source name -- @param dst string: destination name --- @param flags string: additional flags +-- @param recursive True enables recursive copying. The default is false. -- @return bool -- @return the last line ouf captured output -function e2lib.cp(src, dst, flags) - if not flags then - flags = "" +function e2lib.cp(src, dst, recursive) + local argv + + argv = { src, dst } + if recursive then + table.insert(argv, 1, "-R") end - local args = string.format("%s '%s' '%s'", flags, src, dst) - return e2lib.call_tool("cp", args) + + return e2lib.call_tool_argv("cp", argv) end --- call the curl command diff --git a/plugins/svn.lua b/plugins/svn.lua index f482557..45aa9ba 100644 --- a/plugins/svn.lua +++ b/plugins/svn.lua @@ -201,7 +201,7 @@ function svn.prepare_source(info, sourcename, source_set, build_path) -- cp -R info.root/src.working/src.workingcopy_subdir build_path local s = e2lib.join(info.root, src.working, src.workingcopy_subdir) local d = e2lib.join(build_path, src.name) - rc, re = e2lib.cp(s, d, "-R") + rc, re = e2lib.cp(s, d, true) if not rc then return false, e:cat(re) end -- 2.39.5