diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/copy.lua b/src/main/resources/assets/computercraft/lua/rom/programs/copy.lua index c70cd0a64..8158b84a5 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/copy.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/copy.lua @@ -10,12 +10,14 @@ local sDest = shell.resolve( tArgs[2] ) local tFiles = fs.find( sSource ) if #tFiles > 0 then for n,sFile in ipairs( tFiles ) do - if fs.exists( sDest ) == true then - printError( "Destination exists" ) - elseif fs.isDir( sDest ) 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 diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/mkdir.lua b/src/main/resources/assets/computercraft/lua/rom/programs/mkdir.lua index cace3bd55..ed6c5e378 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/mkdir.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/mkdir.lua @@ -6,7 +6,7 @@ end local sNewDir = shell.resolve( tArgs[1] ) -if fs.exists( sNewDir ) == true then +if fs.exists( sNewDir ) then printError( "Destination exists" ) return end diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/rename.lua b/src/main/resources/assets/computercraft/lua/rom/programs/rename.lua index 411019787..f22561c26 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/rename.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/rename.lua @@ -7,7 +7,7 @@ end local sSource = shell.resolve( tArgs[1] ) local sDest = shell.resolve( tArgs[2] ) -if fs.exists( sDest ) == true then +if fs.exists( sDest ) then printError( "Destination exists" ) end