From 7bc9d710bf7456828e51ca7fd9331987fc5bfe2b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sat, 25 Dec 2010 16:15:03 +0000 Subject: [PATCH] installer: improved the check for installed dictionaries git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@196 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- InnoSetupScript/Subtitle_Edit_installer.iss | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/InnoSetupScript/Subtitle_Edit_installer.iss b/InnoSetupScript/Subtitle_Edit_installer.iss index 22b8b393d..92e0bf4fa 100644 --- a/InnoSetupScript/Subtitle_Edit_installer.iss +++ b/InnoSetupScript/Subtitle_Edit_installer.iss @@ -207,12 +207,6 @@ Filename: {app}\SubtitleEdit.exe; Description: {cm:LaunchProgram,Subtitle Edit}; Filename: {#= app_web_site}; Description: {cm:run_VisitWebsite}; Flags: nowait postinstall skipifsilent shellexec runascurrentuser unchecked -[UninstallDelete] -Type: dirifempty; Name: {app}\WaveForms -Type: dirifempty; Name: {userappdata}\Subtitle Edit\WaveForms -Type: dirifempty; Name: {app} - - [Code] // Global variables and constants const installer_mutex_name = 'subtitle_edit_setup_mutex'; @@ -240,10 +234,16 @@ end; // Check if Dictionaries exist function DictionariesExistCheck(): Boolean; +var + FindRec: TFindRec; begin - Result := False; - if DirExists(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries')) then - Result := True; + if FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.aff'), FindRec) OR + FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.dic'), FindRec) OR + FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.xml'), FindRec) then begin + Result := True; + FindClose(FindRec); + end else + Result := False; end; @@ -311,12 +311,14 @@ begin // When uninstalling ask user to delete Subtitle Edit's dictionaries and settings // based on whether these files exist only if CurUninstallStep = usUninstall then begin - if SettingsExistCheck or DictionariesExistCheck then begin + if SettingsExistCheck OR DictionariesExistCheck then begin if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin CleanUpDictionaries; DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml')); end; + RemoveDir(ExpandConstant('{app}\WaveForms')); RemoveDir(ExpandConstant('{app}')); + RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit\WaveForms')); RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit')); end; end;