Skip to content

Commit 0fe95e9

Browse files
authored
Merge pull request #185 from darktable-org/file.lua
file.lua copy for windows
2 parents 92f99c3 + cadd98d commit 0fe95e9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/dtutils/file.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,12 @@ 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+
result = os.execute('copy "' .. fromFile .. '" "' .. toFile .. '"')
296+
elseif dtutils_file.check_if_bin_exists("cp") then
295297
result = os.execute("cp '" .. fromFile .. "' '" .. toFile .. "'")
296298
end
299+
297300
-- if cp was not present, or if cp failed, then a pure lua solution
298301
if not result then
299302
local fileIn, err = io.open(fromFile, 'rb')

0 commit comments

Comments
 (0)