Skip to content

Commit d355095

Browse files
authored
file.lua copy for windows
1 parent eb13518 commit d355095

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/dtutils/file.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,13 @@ dtutils_file.libdoc.functions["file_copy"] = {
291291
function dtutils_file.file_copy(fromFile, toFile)
292292
local result = nil
293293
-- if cp exists, use it
294-
if dtutils_file.check_if_bin_exists("cp") then
294+
if dt.configuration.running_os == "windows" then
295+
os.execute('copy "' .. fromFile .. '" "' .. toFile .. '"')
296+
result = true
297+
elseif dtutils_file.check_if_bin_exists("cp") then
295298
result = os.execute("cp '" .. fromFile .. "' '" .. toFile .. "'")
296299
end
300+
297301
-- if cp was not present, or if cp failed, then a pure lua solution
298302
if not result then
299303
local fileIn, err = io.open(fromFile, 'rb')

0 commit comments

Comments
 (0)