Skip to content

Instantly share code, notes, and snippets.

@Bios-Marcel
Last active October 15, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bios-Marcel/da4ba579aa3f503c122fc3f726dd28f7 to your computer and use it in GitHub Desktop.
Save Bios-Marcel/da4ba579aa3f503c122fc3f726dd28f7 to your computer and use it in GitHub Desktop.
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
FileResult: TFindRec;
AppDir: string;
begin
if FindFirst(ExpandConstant('{app}\'), FileResult) then
begin
try
repeat
if (FileResult.Name = '.') or (FileResult.Name = '..') or (FileResult.Name = 'config') then
begin
Log('Deletion skipped: ' + FileResult.Name);
continue;
end;
Log('Delete: ' + ExpandConstant('{app}\' + FileResult.Name));
DelTree(ExpandConstant('{app}\' + FileResult.Name), FileResult.Attributes and FILE_ATTRIBUTE_DIRECTORY = FILE_ATTRIBUTE_DIRECTORY, True, True);
until not FindNext(FileResult);
finally
FindClose(FileResult);
end;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment