filestorage RemoveOnTerminate property
Return to Introduction  Previous page  Next page
Applies to
acFileStorage component, as subproperty of AutoExtract structure.  

Declaration
property RemoveOnTerminate: Boolean;  

Description
If RemoveOnTerminate property is True then all automatically extracted files will be deleted on program termination. If the target Subdirectory is specified, the acFileStorage will also try to delete the subdirectory, if it is empty.  

Warning!
iiwarning If you have more than one instance of your application running and RemoveOnTerminate flag is True, you have a risk that the second closed instance will delete the first instance's files when it closes. Such risk exists even if you are using acOnlyOne to prevent execution of second instances. However there is a way to avoid this. You just need to hook OnAlreadyExists event of acOnlyOne and turn off RemoveOnTerminate flag in acFileStorage:  
procedure TForm1.acOnlyOne1AlreadyExist(Sender: TObject);  
begin  
  acFileStorage1.AutoExtract.RemoveOnTerminate := False;  
  // messagebox  
end;  

Remarks
iiinfo It will remove only files extracted per current application session, and will not delete files that was exist before extracting. If you wish to be sure that ALL files are stored on start and definitely deleted on termination — set Overwrite property to owAlways.  

See also
Enabled and Overwrite properties; SubDirectory property of ExtractTo structure.