-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlazswitchhosts.lpr
More file actions
39 lines (34 loc) · 918 Bytes
/
Copy pathlazswitchhosts.lpr
File metadata and controls
39 lines (34 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
program lazswitchhosts;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Interfaces, SysUtils,
Forms, Dialogs, unitmain, unitutils;
var
EnvValue: string;
{$R *.res}
begin
ConfigSwitchHostsDir := GetHomeDir + DirectorySeparator + '.SwitchHosts';
SystemHostsFilename := EtcHostsFilename;
EnvValue := GetEnvironmentVariable('LAZ_SWITCHHOSTSDIR');
if EnvValue <> '' then
ConfigSwitchHostsDir := EnvValue;
EnvValue := GetEnvironmentVariable('LAZ_HOSTSFILENAME');
if EnvValue <> '' then
SystemHostsFilename := EnvValue;
if not AcquireSingleInstanceLock then
begin
ShowMessage('LazSwitchHosts 已经在运行中');
Halt;
end;
RequireDerivedFormResource := True;
Application.Scaled:=True;
{$PUSH}{$WARN 5044 OFF}
Application.MainFormOnTaskbar := True;
{$POP}
Application.Initialize;
Application.CreateForm(TFormMain, FormMain);
Application.Run;
end.