OberonCore https://forum.oberoncore.ru/ |
|
Inno setup Code https://forum.oberoncore.ru/viewtopic.php?f=27&t=3977 |
Страница 1 из 1 |
Автор: | Alexanbar [ Пятница, 25 Май, 2012 14:46 ] |
Заголовок сообщения: | Inno setup Code |
Указанный инсталлятор позволяет использовать код на встроенном Паскале. Хотелось бы узнать: 1) как перечислить файлы в заданной папке по указанному шаблону (чтобы потом скопировать их в другую папку) 2) где объявить публичные переменные? Я полагаю, в начале секции??? |
Автор: | Alexanbar [ Среда, 30 Май, 2012 13:33 ] |
Заголовок сообщения: | Re: Inno setup Code |
Отвечаю сам на свой вопрос: Код: var
oldPath: String; ////////////////////////////////// function GetOldPath(): String; var sUnInstPath: String; sOldPath: String; begin sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\Моя программа_is1'); sOldPath := ''; if not RegQueryStringValue(HKLM, sUnInstPath, 'Inno Setup: App Path', sOldPath) then RegQueryStringValue(HKCU, sUnInstPath, 'Inno Setup: App Path', sOldPath); Result := ExpandConstant(sOldPath); end; /////////////////////////////////// procedure CopyRegFiles; var FL: TFindRec; pt1,pt2 : String; begin pt1 := AddBackslash(OldPath); pt2 := AddBackslash(ExpandConstant('{app}')); if (Length(oldPath) > 0) and (pt1 <> pt2) then begin try if FindFirst(pt1 + '*.xyz', FL) then begin repeat FileCopy(pt1 + FL.Name, pt2 + FL.Name,False); until not FindNext(FL); end; finally FindClose(FL); end; end; end; ///////////////////////////////// //function UnInstallOldVersion(): Integer; //......... //end; procedure CurStepChanged(CurStep: TSetupStep); begin if (CurStep=ssInstall) then begin oldPath := GetOldPath; //UnInstallOldVersion(); end; if (CurStep=ssPostInstall) then begin CopyRegFiles; end; end; |
Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |