Skip to content

Commit

Permalink
fix: Installer progress bar should not 100% while downloading depende…
Browse files Browse the repository at this point in the history
…ncies
  • Loading branch information
hientominh authored and hiento09 committed Oct 3, 2024
1 parent 7b80e2e commit 76b23b0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
22 changes: 21 additions & 1 deletion engine/templates/windows/installer-beta.iss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ var
ResultCode: Integer;
begin
ExpandedAppDir := ExpandConstant('{app}');
// Set the maximum value for the progress bar to 100 (representing 100%)
WizardForm.ProgressGauge.Max := 100;
// Set the progress bar to 80%
WizardForm.ProgressGauge.Position := 80;
WizardForm.ProgressGauge.Update;
// Add {app} to PATH
CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
Expand All @@ -48,15 +55,28 @@ begin
WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...';
WizardForm.StatusLabel.Update;
// Set the progress bar to 85% after adding to PATH
WizardForm.ProgressGauge.Position := 85;
WizardForm.ProgressGauge.Update;
// Download llamacpp engine by default
CortexInstallCmd := Format('"%s\cortex-beta.exe" engines install cortex.llamacpp', [ExpandedAppDir]);
Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
// Clear the status message after completion
// Set the progress bar to 90% after downloading the engine
WizardForm.ProgressGauge.Position := 90;
WizardForm.ProgressGauge.Update;
// Clear status message after completion
WizardForm.StatusLabel.Caption := '';
WizardForm.StatusLabel.Update;
// Set the progress bar to 100% after completion
WizardForm.ProgressGauge.Position := 100;
WizardForm.ProgressGauge.Update;
end;
procedure DeleteCurrentUserCortexFolderAndConfig;
var
UserCortexFolder: String;
Expand Down
22 changes: 21 additions & 1 deletion engine/templates/windows/installer-nightly.iss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ var
ResultCode: Integer;
begin
ExpandedAppDir := ExpandConstant('{app}');
// Set the maximum value for the progress bar to 100 (representing 100%)
WizardForm.ProgressGauge.Max := 100;
// Set the progress bar to 80%
WizardForm.ProgressGauge.Position := 80;
WizardForm.ProgressGauge.Update;
// Add {app} to PATH
CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
Expand All @@ -48,15 +55,28 @@ begin
WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...';
WizardForm.StatusLabel.Update;
// Set the progress bar to 85% after adding to PATH
WizardForm.ProgressGauge.Position := 85;
WizardForm.ProgressGauge.Update;
// Download llamacpp engine by default
CortexInstallCmd := Format('"%s\cortex-nightly.exe" engines install cortex.llamacpp', [ExpandedAppDir]);
Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
// Clear the status message after completion
// Set the progress bar to 90% after downloading the engine
WizardForm.ProgressGauge.Position := 90;
WizardForm.ProgressGauge.Update;
// Clear status message after completion
WizardForm.StatusLabel.Caption := '';
WizardForm.StatusLabel.Update;
// Set the progress bar to 100% after completion
WizardForm.ProgressGauge.Position := 100;
WizardForm.ProgressGauge.Update;
end;
procedure DeleteCurrentUserCortexFolderAndConfig;
var
UserCortexFolder: String;
Expand Down
22 changes: 21 additions & 1 deletion engine/templates/windows/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ var
ResultCode: Integer;
begin
ExpandedAppDir := ExpandConstant('{app}');
// Set the maximum value for the progress bar to 100 (representing 100%)
WizardForm.ProgressGauge.Max := 100;
// Set the progress bar to 80%
WizardForm.ProgressGauge.Position := 80;
WizardForm.ProgressGauge.Update;
// Add {app} to PATH
CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
Expand All @@ -48,15 +55,28 @@ begin
WizardForm.StatusLabel.Caption := 'Downloading llama.cpp engine and dependencies ...';
WizardForm.StatusLabel.Update;
// Set the progress bar to 85% after adding to PATH
WizardForm.ProgressGauge.Position := 85;
WizardForm.ProgressGauge.Update;
// Download llamacpp engine by default
CortexInstallCmd := Format('"%s\cortex.exe" engines install cortex.llamacpp', [ExpandedAppDir]);
Exec('cmd.exe', '/C ' + CortexInstallCmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
// Clear the status message after completion
// Set the progress bar to 90% after downloading the engine
WizardForm.ProgressGauge.Position := 90;
WizardForm.ProgressGauge.Update;
// Clear status message after completion
WizardForm.StatusLabel.Caption := '';
WizardForm.StatusLabel.Update;
// Set the progress bar to 100% after completion
WizardForm.ProgressGauge.Position := 100;
WizardForm.ProgressGauge.Update;
end;
procedure DeleteCurrentUserCortexFolderAndConfig;
var
UserCortexFolder: String;
Expand Down

0 comments on commit 76b23b0

Please sign in to comment.