diff --git a/sys/apis/util.lua b/sys/apis/util.lua index b2f7900..771bcbb 100644 --- a/sys/apis/util.lua +++ b/sys/apis/util.lua @@ -405,7 +405,11 @@ function Util.readFile(fname) end function Util.backup(fname) - fs.copy(fname, fname .. '.bak') + local backup = fname .. '.bak' + if backup then + fs.delete(backup) + end + fs.copy(fname, backup) end function Util.writeFile(fname, data)