Skip to content

Commit

Permalink
Merge branch 'check-wsl-before-main'
Browse files Browse the repository at this point in the history
  • Loading branch information
emeric-martineau committed Jun 4, 2022
2 parents e927667 + 0aef61b commit 29a52ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
14 changes: 0 additions & 14 deletions src/mainwindow.pas
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ TWslGuiToolMainWindow = class(TForm)
IconListToolbar: TImageList;
ToolBar1: TToolBar;
ToolButtonRun: TToolButton;
procedure CheckIfWslIsInstalledExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
Expand Down Expand Up @@ -240,18 +239,6 @@ function NumberItemSelected(List: TListView): integer;
end;
end;

procedure TWslGuiToolMainWindow.CheckIfWslIsInstalledExecute(Sender: TObject);
begin
if not WslCommandLine.IsWslInstalled()
then begin
Application.MessageBox(
'WSL seems to be not installed!',
'Error',
MB_OK + MB_ICONERROR);
Application.Terminate;
end;
end;

procedure TWslGuiToolMainWindow.FormCreate(Sender: TObject);
begin
BackgroundProcessProgressBar := TBackgroundProcessProgressBar.Create(Self);
Expand All @@ -263,7 +250,6 @@ procedure TWslGuiToolMainWindow.FormCreate(Sender: TObject);

StatusbarImageIndex := -1;
StatusbarMessage := '';
Self.CheckIfWslIsInstalledExecute(Sender);
end;

procedure TWslGuiToolMainWindow.FormDestroy(Sender: TObject);
Expand Down
20 changes: 16 additions & 4 deletions src/wslguitool.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,28 @@
ApplicationInfo, AboutWindow, DistributionPropertiesWindow,
ImportDistributionWindow, RunCommandWithUserWindow, PromptWindow,
BackgroundProcessProgressBar, ProcessResultDisplay, WslConfigEditWindow,
Wslconfig, WslconfigParameterCtrl;

Wslconfig, WslconfigParameterCtrl, LCLType;

{$R *.res}

begin
RequireDerivedFormResource:=True;

Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TWslGuiToolMainWindow, WslGuiToolMainWindow);
Application.Run;

if WslCommandLine.IsWslInstalled() then
begin
Application.CreateForm(TWslGuiToolMainWindow, WslGuiToolMainWindow);
Application.Run;
end
else begin
Application.MessageBox(
'WSL seems to be not installed!',
'Error',
MB_OK + MB_ICONERROR
);
Application.Terminate;
end;
end.

Binary file modified src/wslguitool.res
Binary file not shown.

0 comments on commit 29a52ee

Please sign in to comment.