]> git.e2factory.org Git - e2factory.git/commitdiff
e2lib.cp: change flags to recursive and use an argv
authorTobias Ulmer <tu@emlix.com>
Fri, 15 Nov 2013 17:03:41 +0000 (18:03 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua
plugins/svn.lua

index ee055425f119043f1204dbe87a7403ec185db740..c900ce1177bf8435b2f41289b3dcc578bde75079 100644 (file)
@@ -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
index f482557bfcb42914b68f0d4ad36b08c8c39122a4..45aa9ba2e3024dec76a3ee0176384970671fff13 100644 (file)
@@ -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