1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-12-12 00:38:05 +00:00

Improve rename.lua's argument validation

This commit is contained in:
JakobDev
2019-06-10 15:31:38 +02:00
committed by SquidDev
parent 309cbdb8be
commit f3798bfb63
2 changed files with 48 additions and 1 deletions

View File

@@ -7,8 +7,15 @@ end
local sSource = shell.resolve( tArgs[1] )
local sDest = shell.resolve( tArgs[2] )
if fs.exists( sDest ) then
if not fs.exists( sSource ) then
printError( "No matching files" )
return
elseif fs.exists( sDest ) then
printError( "Destination exists" )
return
elseif fs.isReadOnly( sDest ) then
printError( "Destination is read-only" )
return
end
fs.move( sSource, sDest )