Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added COPYFILE and COPYDIR tokens #1528

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/base/os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,12 @@
copy = function(v)
return "cp -rf " .. path.normalize(v)
end,
copyfile = function(v)
return "cp -f " .. path.normalize(v)
end,
copydir = function(v)
return "cp -rf " .. path.normalize(v)
end,
delete = function(v)
return "rm -f " .. path.normalize(v)
end,
Expand Down Expand Up @@ -606,6 +612,17 @@

return "IF EXIST " .. src .. "\\ (xcopy /Q /E /Y /I " .. v .. " > nul) ELSE (xcopy /Q /Y /I " .. v .. " > nul)"
end,
copyfile = function(v)
v = path.translate(path.normalize(v))
-- XCOPY doesn't have a switch to assume destination is a file when it doesn't exist.
-- A trailing * will suppress the prompt but requires the file extensions be the same length.
-- Just use COPY instead, it actually works.
return "copy /B /Y " .. v
end,
copydir = function(v)
v = path.translate(path.normalize(v))
return "xcopy /Q /E /Y /I " .. v
end,
delete = function(v)
return "del " .. path.translate(path.normalize(v))
end,
Expand Down