Wykorzystaj funkcje ShouldSkipPage
i zależnie od zaznaczonego komponentu wyświetl.
Kolejność kiedy ma byc wyświetlana strona zalezy od pierwszego argumenu funkcji CreateInputFilePage
teraz wyswietli się po komponentach.
Masz błąd w linijce:
if not DirExists(battletechPage.Values[0] + '\BattleTech_Data\StreamingAssets\data\flashpoints') then
Warośc battletechPage.Values[0]
to ścieżka razem z plikiem więc sprawdzasz taki katalog:
c:\folder\battletech.exe\BattleTech_Data\StreamingAssets\data\flashpoints więc raczej cięzko aby istniała użyj ExtractFileDir(battletechPage.Values[0])
[Setup]
AppName=4p
AppVersion=1
AlwaysShowComponentsList=yes
DefaultDirName={sd}\4p
[Types]
Name: "Core"; Description: "Mech Designer required files"; Flags: iscustom
Name: "Flashpoint"; Description: "Flashpoint mechs data files"
[Components]
Name: "MechDesigner"; Description: "Mech Designer core files"; Types: Core
Name: "FlashpointPack"; Description: "Flashpoint mechs pack"; Types: Core Flashpoint
[Code]
var
battletechPage: TInputFileWizardPage;
battletechPageID: Integer;
procedure InitializeWizard;
begin
battletechPage := CreateInputFilePage(wpSelectTasks, 'Mech pack requires additional path leading to battletech.exe', '', 'Navigate to and point the battletech.exe from expansion');
battletechPage.Add('Path to battletech.exe', 'battletech.exe|battletech.exe', '.exe');
battletechPageID := battletechPage.ID;
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
// Store the selected folder for further reinstall/upgrade
SetPreviousData(PreviousDataKey, 'battletechfile', battletechPage.Values[0]);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID = battletechPageID then
begin
if battletechPage.Values[0] = '' then
begin
MsgBox('You have to select the battletech.exe!', mbInformation, MB_OK);
Result := False;
end
else
begin
//KOD JAK JEST OK
msgbox(ExtractFileDir(battletechPage.Values[0]), mbInformation, MB_OK);
//oto co ja dodałem. Zaraz odpalę gógle aby znaleźć "pascal string concatenation"
//hmmm no niby twierdzą w https://www.freepascal.org/docs-html/rtl/system/concat.html, że operator + działa, to czemu nie wykrywa warunku??
if not DirExists(ExtractFileDir(battletechPage.Values[0]) + '\BattleTech_Data\StreamingAssets\data\flashpoints') then
begin
msgbox('Wrong path! You have to navigare to Flashpoint main folder!', mbInformation, MB_OK);
Result := false;
//tu sprawdzenie czy w dobre miejsce użytkownik pokierował
end;
end;
end;
end;
function battletechDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := ExtractFileDir(battletechPage.Values[0]);
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = battletechPageID then
Result := not IsComponentSelected('FlashpointPack');
end;