diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-05-05 20:14:54 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-05-05 20:14:54 +0400 |
commit | 08f3ce85d9f6fc9937d2997b074c06198194c8c9 (patch) | |
tree | 2434f82ff65139433d497b7ffc0fcb932ac20f4d | |
parent | a494e4d81e9e8ea0128f143259d21de56ecd8409 (diff) |
added a mutex in the installer and did some refactoring in the installer's script
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1848 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r-- | distrib/custom_messages.iss | 57 | ||||
-rw-r--r-- | distrib/mpc-hc_setup.iss | 53 |
2 files changed, 76 insertions, 34 deletions
diff --git a/distrib/custom_messages.iss b/distrib/custom_messages.iss index b9056cf7c..b39cf58e5 100644 --- a/distrib/custom_messages.iss +++ b/distrib/custom_messages.iss @@ -5,157 +5,176 @@ ;English
en.langid=00000000
+en.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+en.msg_SetupIsRunningWarning=MPC-HC setup is already running!
en.tsk_AllUsers=For all users
en.tsk_CurrentUser=For the current user only
en.tsk_Other=Other tasks:
en.tsk_ResetSettings=Reset settings
-en.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
#if localize
;Portuguese (Brasil)
br.langid=00000017
+br.msg_DeleteSettings=Gostaria tambem de apagar os ajustes do MPC-HC? %nSe voce quiser instalar o MPC-HC novamente então não precisa apagá-los.
+br.msg_SetupIsRunningWarning=MPC-HC setup is already running!
br.tsk_AllUsers=Para todos os usuarios
br.tsk_CurrentUser=Para o usuario atual somente
br.tsk_Other=Outras tarefas:
br.tsk_ResetSettings=Resetar ajustes
-br.msg_DeleteSettings=Gostaria tambem de apagar os ajustes do MPC-HC? %nSe voce quiser instalar o MPC-HC novamente então não precisa apagá-los.
;Belarusian
by.langid=00000015
+by.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+by.msg_SetupIsRunningWarning=MPC-HC setup is already running!
by.tsk_AllUsers=For all users
by.tsk_CurrentUser=For the current user only
by.tsk_Other=Other tasks:
by.tsk_ResetSettings=Reset settings
-by.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Czech
cz.langid=00000005
+cz.msg_DeleteSettings=Chcete smazat také nastavení MPC-HC? %nPokud plánujete MPC-HC znovu nainstalovat, mazat je nemusíte.
+cz.msg_SetupIsRunningWarning=MPC-HC setup is already running!
cz.tsk_AllUsers=Pro všechny uživatele
cz.tsk_CurrentUser=Jen pro právě přihlášeného uživatele
cz.tsk_Other=Ostatní úlohy:
cz.tsk_ResetSettings=Obnovit výchozí nastavení
-cz.msg_DeleteSettings=Chcete smazat také nastavení MPC-HC? %nPokud plánujete MPC-HC znovu nainstalovat, mazat je nemusíte.
;German
de.langid=00000002
+de.msg_DeleteSettings=Wollen Sie auch die Einstellungen des MPC-HC löschen? %nWenn Sie den MPC-HC wieder installieren wollen, dann müssen Sie diese nicht unbedingt löschen.
+de.msg_SetupIsRunningWarning=MPC-HC setup is already running!
de.tsk_AllUsers=Für alle Benutzer
de.tsk_CurrentUser=Für aktuellen Benutzer
de.tsk_Other=Andere Aufgaben:
de.tsk_ResetSettings=Einstellungen zurücksetzen
-de.msg_DeleteSettings=Wollen Sie auch die Einstellungen des MPC-HC löschen? %nWenn Sie den MPC-HC wieder installieren wollen, dann müssen Sie diese nicht unbedingt löschen.
;Spanish
es.langid=00000006
+es.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+es.msg_SetupIsRunningWarning=MPC-HC setup is already running!
es.tsk_AllUsers=For all users
es.tsk_CurrentUser=For the current user only
es.tsk_Other=Other tasks:
es.tsk_ResetSettings=Reset settings
-es.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;French
fr.langid=00000001
+fr.msg_DeleteSettings=Voulez-vous aussi supprimer les paramètres de MPC-HC ? %nSi vous voulez réinstaller MPC-HC, il est conseillé de ne pas les supprimer.
+fr.msg_SetupIsRunningWarning=MPC-HC setup is already running!
fr.tsk_AllUsers=Pour tout les utilisateurs
fr.tsk_CurrentUser=Pour l'utilisateur courant seulement
fr.tsk_Other=Autres tâches:
fr.tsk_ResetSettings=Initialisation des paramètres
-fr.msg_DeleteSettings=Voulez-vous aussi supprimer les paramètres de MPC-HC ? %nSi vous voulez réinstaller MPC-HC, il est conseillé de ne pas les supprimer.
;Hungarian
hu.langid=00000007
+hu.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+hu.msg_SetupIsRunningWarning=MPC-HC setup is already running!
hu.tsk_AllUsers=For all users
hu.tsk_CurrentUser=For the current user only
hu.tsk_Other=Other tasks:
hu.tsk_ResetSettings=Reset settings
-hu.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Italian
it.langid=00000011
+it.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+it.msg_SetupIsRunningWarning=MPC-HC setup is already running!
it.tsk_AllUsers=For all users
it.tsk_CurrentUser=For the current user only
it.tsk_Other=Other tasks:
it.tsk_ResetSettings=Reset settings
-it.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Korean
kr.langid=00000008
+kr.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+kr.msg_SetupIsRunningWarning=MPC-HC setup is already running!
kr.tsk_AllUsers=For all users
kr.tsk_CurrentUser=For the current user only
kr.tsk_Other=Other tasks:
kr.tsk_ResetSettings=Reset settings
-kr.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Dutch
nl.langid=00000018
+nl.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+nl.msg_SetupIsRunningWarning=MPC-HC setup is already running!
nl.tsk_AllUsers=For all users
nl.tsk_CurrentUser=For the current user only
nl.tsk_Other=Other tasks:
nl.tsk_ResetSettings=Reset settings
-nl.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Polish
pl.langid=00000009
+pl.msg_DeleteSettings=Czy chcesz usunąć ustawienia MPC-HC? %nJeśli planujesz ponownie zainstalować MPC-HC, wtedy nie trzeba ich usuwać.
+pl.msg_SetupIsRunningWarning=MPC-HC setup is already running!
pl.tsk_AllUsers=Dla wszystkich użytkowników
pl.tsk_CurrentUser=Tylko dla bieżącego użytkownika
pl.tsk_Other=Inne zadania:
pl.tsk_ResetSettings=Resetuj ustawienia
-pl.msg_DeleteSettings=Czy chcesz usunąć ustawienia MPC-HC? %nJeśli planujesz ponownie zainstalować MPC-HC, wtedy nie trzeba ich usuwać.
;Russian
ru.langid=00000003
+ru.msg_DeleteSettings=Хотите ли вы удалить настройки MPC-HC? %nЕсли вы планируете переустановить MPC-HC, то вам не нужно их удалять.
+ru.msg_SetupIsRunningWarning=MPC-HC setup is already running!
ru.tsk_AllUsers=Для всех пользователей этого компьютера
ru.tsk_CurrentUser=Только для текущего пользователя
ru.tsk_Other=Другие задачи:
ru.tsk_ResetSettings=Сбросить настройки
-ru.msg_DeleteSettings=Хотите ли вы удалить настройки MPC-HC? %nЕсли вы планируете переустановить MPC-HC, то вам не нужно их удалять.
;Chinese Simplified
sc.langid=00000013
+sc.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+sc.msg_SetupIsRunningWarning=MPC-HC setup is already running!
sc.tsk_AllUsers=For all users
sc.tsk_CurrentUser=For the current user only
sc.tsk_Other=Other tasks:
sc.tsk_ResetSettings=Reset settings
-sc.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Swedish
se.langid=00000016
+se.msg_DeleteSettings=Vill du också ta bort MPC-HC inställningar? %nOm du planerar att installera MPC-HC igen så behöver du inte radera dem.
+se.msg_SetupIsRunningWarning=MPC-HC setup is already running!
se.tsk_AllUsers=För alla användare
se.tsk_CurrentUser=Endast för den aktuella användaren
se.tsk_Other=Andra uppgifter:
se.tsk_ResetSettings=Återställ inställningar
-se.msg_DeleteSettings=Vill du också ta bort MPC-HC inställningar? %nOm du planerar att installera MPC-HC igen så behöver du inte radera dem.
;Slovakian
sk.langid=00000012
+sk.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+sk.msg_SetupIsRunningWarning=MPC-HC setup is already running!
sk.tsk_AllUsers=For all users
sk.tsk_CurrentUser=For the current user only
sk.tsk_Other=Other tasks:
sk.tsk_ResetSettings=Reset settings
-sk.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Chinese Traditional
tc.langid=00000014
+tc.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+tc.msg_SetupIsRunningWarning=MPC-HC setup is already running!
tc.tsk_AllUsers=For all users
tc.tsk_CurrentUser=For the current user only
tc.tsk_Other=Other tasks:
tc.tsk_ResetSettings=Reset settings
-tc.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Turkish
tr.langid=00000004
+tr.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
+tr.msg_SetupIsRunningWarning=MPC-HC setup is already running!
tr.tsk_AllUsers=For all users
tr.tsk_CurrentUser=For the current user only
tr.tsk_Other=Other tasks:
tr.tsk_ResetSettings=Reset settings
-tr.msg_DeleteSettings=Do you also want to delete MPC-HC settings? %nIf you plan on installing MPC-HC again then you do not have to delete them.
;Ukrainian
ua.langid=00000010
+ua.msg_DeleteSettings=Чи хочете ви видалити налаштування MPC-HC? %nЯкщо ви плануєте просто повторно встановити MPC-HC, то вам не потрібно їх видаляти.
+ua.msg_SetupIsRunningWarning=MPC-HC setup is already running!
ua.tsk_AllUsers=Для всіх користувачів
ua.tsk_CurrentUser=Лише для поточного користувача
ua.tsk_Other=Інші завдання:
ua.tsk_ResetSettings=Скинути налаштування
-ua.msg_DeleteSettings=Чи хочете ви видалити налаштування MPC-HC? %nЯкщо ви плануєте просто повторно встановити MPC-HC, то вам не потрібно їх видаляти.
#endif
diff --git a/distrib/mpc-hc_setup.iss b/distrib/mpc-hc_setup.iss index 5731ba49b..7176e427c 100644 --- a/distrib/mpc-hc_setup.iss +++ b/distrib/mpc-hc_setup.iss @@ -148,10 +148,6 @@ Source: ..\src\apps\mplayerc\ChangeLog; DestDir: {app}; Flags: ignoreversion Source: ..\COPYING; DestDir: {app}; Flags: ignoreversion
-[Registry]
-Root: HKCU; Subkey: Software\Gabest\Media Player Classic; Tasks: reset_settings; Flags: deletekey uninsdeletekeyifempty
-
-
[Run]
Filename: {app}\{#mpchc_exe}; Description: {cm:LaunchProgram,{#app_name}}; Flags: nowait postinstall skipifsilent unchecked
@@ -175,13 +171,13 @@ Name: {group}\{cm:UninstallProgram,{#app_name}}; Filename: {uninstallexe}; Comme [InstallDelete]
Type: files; Name: {userdesktop}\{#app_name}.lnk; Check: NOT IsTaskSelected('desktopicon\user')
Type: files; Name: {commondesktop}\{#app_name}.lnk; Check: NOT IsTaskSelected('desktopicon\common')
-Type: files; Name: {app}\{#mpchc_ini}; Tasks: reset_settings
-Type: files; Name: {app}\*.bak; Tasks: reset_settings
-Type: files; name: {userappdata}\Media Player Classic\default.mpcpl; Tasks: reset_settings
-Type: dirifempty; Name: {userappdata}\Media Player Classic; Tasks: reset_settings
[Code]
+// Global variables and constants
+const installer_mutex_name = 'mpchc_setup_mutex';
+
+
// Check if MPC-HC's settings exist
function SettingsExistCheck(): Boolean;
begin
@@ -190,6 +186,7 @@ begin Result := True;
end;
+
function GetInstallFolder(Default: String): String;
var
InstallPath: String;
@@ -206,12 +203,29 @@ begin end;
+procedure CleanUpSettingsAndFiles();
+begin
+ DeleteFile(ExpandConstant('{app}\*.bak'));
+ DeleteFile(ExpandConstant('{app}\{#mpchc_ini}'));
+ DeleteFile(ExpandConstant('{userappdata}\Media Player Classic\default.mpcpl'));
+ RemoveDir(ExpandConstant('{userappdata}\Media Player Classic'));
+ RegDeleteKeyIncludingSubkeys(HKCU, 'Software\Gabest\Media Player Classic');
+ RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Gabest\Media Player Classic');
+ RegDeleteKeyIfEmpty(HKCU, 'Software\Gabest');
+ RegDeleteKeyIfEmpty(HKLM, 'SOFTWARE\Gabest');
+end;
+
+
procedure CurStepChanged(CurStep: TSetupStep);
Var
lang : Integer;
begin
- if CurStep = ssDone then begin
+ if CurStep = ssPostInstall then begin
+ if IsTaskSelected('reset_settings') then begin
+ CleanUpSettingsAndFiles;
+ end;
lang := StrToInt(ExpandConstant('{cm:langid}'));
+ RegWriteStringValue(HKLM, 'SOFTWARE\Gabest\Media Player Classic', 'ExePath', ExpandConstant('{app}\{#mpchc_exe}'));
if FileExists(ExpandConstant('{app}\{#mpchc_ini}')) then
SetIniInt('Settings', 'InterfaceLanguage', lang, ExpandConstant('{app}\{#mpchc_ini}'))
else
@@ -226,13 +240,22 @@ begin if CurUninstallStep = usUninstall then begin
if SettingsExistCheck() then begin
if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin
- DeleteFile(ExpandConstant('{userappdata}\Media Player Classic\default.mpcpl'));
- RemoveDir(ExpandConstant('{userappdata}\Media Player Classic'));
- RegDeleteKeyIncludingSubkeys(HKCU, 'Software\Gabest\Media Player Classic');
- RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Gabest\Media Player Classic');
- RegDeleteKeyIfEmpty(HKCU, 'SOFTWARE\Gabest');
- RegDeleteKeyIfEmpty(HKLM, 'SOFTWARE\Gabest');
+ CleanUpSettingsAndFiles;
end;
end;
end;
end;
+
+
+function InitializeSetup(): Boolean;
+begin
+ Result := True;
+ // Create a mutex for the installer and if it's already running display a message and stop installation
+ if CheckForMutexes(installer_mutex_name) then begin
+ if not WizardSilent() then
+ MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK);
+ Result := False;
+ end else begin
+ CreateMutex(installer_mutex_name);
+ end;
+end;
|