TFile.Delete

From Soldat Community Wiki
Jump to: navigation, search
function Delete(const Source: string): Boolean
 Source: a path to a file to delete
 Result: Whenever delete was successful or not

Description

This function deletes file pointed by Source. If the path is out of script's sandbox, EAccessViolation exception is thrown.

Example

begin 
  if File.Exists('soldat.ini.bak') then
    try
      File.Delete('soldat.ini.bak');
    except    
      Player.WriteConsole('Path out of sandbox', $FFFFFFFF);
    end;
  else
    Player.WriteConsole('Cannot delete the backup', $FFFFFFFF);
end;