From d355095e16a66e0d4f1b580777959165b20aaaeb Mon Sep 17 00:00:00 2001 From: supertobi Date: Mon, 15 Apr 2019 15:27:53 +0200 Subject: [PATCH] file.lua copy for windows --- lib/dtutils/file.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dtutils/file.lua b/lib/dtutils/file.lua index 69243e9..90fdf08 100644 --- a/lib/dtutils/file.lua +++ b/lib/dtutils/file.lua @@ -291,9 +291,13 @@ dtutils_file.libdoc.functions["file_copy"] = { function dtutils_file.file_copy(fromFile, toFile) local result = nil -- if cp exists, use it - if dtutils_file.check_if_bin_exists("cp") then + if dt.configuration.running_os == "windows" then + os.execute('copy "' .. fromFile .. '" "' .. toFile .. '"') + result = true + elseif dtutils_file.check_if_bin_exists("cp") then result = os.execute("cp '" .. fromFile .. "' '" .. toFile .. "'") end + -- if cp was not present, or if cp failed, then a pure lua solution if not result then local fileIn, err = io.open(fromFile, 'rb')