1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-13 03:30:29 +00:00

Merge pull request #411 from Wilma456/copyfixup

Fix Bug in copy.lua, mkdir.lua and rename.lua (updated)
This commit is contained in:
Daniel Ratcliffe 2018-01-13 00:32:55 +00:00 committed by GitHub
commit f30c4f16c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -13,7 +13,11 @@ if #tFiles > 0 then
if fs.isDir( sDest ) then
fs.copy( sFile, fs.combine( sDest, fs.getName(sFile) ) )
elseif #tFiles == 1 then
fs.copy( sFile, sDest )
if fs.exists( sDest ) then
printError( "Destination exists" )
else
fs.copy( sFile, sDest )
end
else
printError( "Cannot overwrite file multiple times" )
return

View File

@ -5,5 +5,11 @@ if #tArgs < 1 then
end
local sNewDir = shell.resolve( tArgs[1] )
if fs.exists( sNewDir ) and not fs.isDir(sNewDir) then
printError( "Destination exists" )
return
end
fs.makeDir( sNewDir )

View File

@ -6,4 +6,9 @@ end
local sSource = shell.resolve( tArgs[1] )
local sDest = shell.resolve( tArgs[2] )
if fs.exists( sDest ) then
printError( "Destination exists" )
end
fs.move( sSource, sDest )