TFile.Delete

From Soldat Community Wiki
Revision as of 23:49, 26 July 2013 by Falcon (talk | contribs) (Created page with " '''''function Delete(const Source: string): Boolean''''' Source: a path to a file to delete Result: Whenever delete was successful or not ==Description== This function de...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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;