installer: improved the check for installed dictionaries

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@196 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
XhmikosR 2010-12-25 16:15:03 +00:00
parent 9a68283d82
commit 7bc9d710bf

View File

@ -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 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] [Code]
// Global variables and constants // Global variables and constants
const installer_mutex_name = 'subtitle_edit_setup_mutex'; const installer_mutex_name = 'subtitle_edit_setup_mutex';
@ -240,10 +234,16 @@ end;
// Check if Dictionaries exist // Check if Dictionaries exist
function DictionariesExistCheck(): Boolean; function DictionariesExistCheck(): Boolean;
var
FindRec: TFindRec;
begin begin
Result := False; if FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.aff'), FindRec) OR
if DirExists(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries')) then FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.dic'), FindRec) OR
Result := True; FindFirst(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.xml'), FindRec) then begin
Result := True;
FindClose(FindRec);
end else
Result := False;
end; end;
@ -311,12 +311,14 @@ begin
// When uninstalling ask user to delete Subtitle Edit's dictionaries and settings // When uninstalling ask user to delete Subtitle Edit's dictionaries and settings
// based on whether these files exist only // based on whether these files exist only
if CurUninstallStep = usUninstall then begin 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 if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin
CleanUpDictionaries; CleanUpDictionaries;
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml')); DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
end; end;
RemoveDir(ExpandConstant('{app}\WaveForms'));
RemoveDir(ExpandConstant('{app}')); RemoveDir(ExpandConstant('{app}'));
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit\WaveForms'));
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit')); RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit'));
end; end;
end; end;