fork/wezterm
git clone https://git.julia.blue/fork/wezterm
00644d4e1
termiz-0.23.3
1; Script generated by the Inno Setup Script Wizard. 2; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3; vim:ts=2:sw=2:et: 4 5#define MyAppName "WezTerm" 6;#define MyAppVersion "1.5" 7#define MyAppPublisher "Wez Furlong" 8#define MyAppURL "http://wezterm.org" 9#define MyAppExeName "wezterm-gui.exe" 10 11[Setup] 12AppId={{BCF6F0DA-5B9A-408D-8562-F680AE6E1EAF} 13ArchitecturesAllowed=x64 arm64 14ArchitecturesInstallIn64BitMode=x64 arm64 15AppName={#MyAppName} 16AppVersion={#MyAppVersion} 17;AppVerName={#MyAppName} {#MyAppVersion} 18AppPublisher={#MyAppPublisher} 19AppPublisherURL={#MyAppURL} 20AppSupportURL={#MyAppURL} 21AppUpdatesURL={#MyAppURL} 22DefaultDirName={autopf}\{#MyAppName} 23DisableProgramGroupPage=yes 24;LicenseFile=..\LICENSE.md 25; Remove the following line to run in administrative install mode (install for all users.) 26;PrivilegesRequired=lowest 27;PrivilegesRequiredOverridesAllowed=dialog 28OutputDir=.. 29OutputBaseFilename=WezTerm-Setup 30SetupIconFile=..\assets\windows\terminal.ico 31UninstallDisplayIcon={app}\{#MyAppExeName} 32Compression=lzma 33SolidCompression=yes 34WizardStyle=modern 35; Build 1809 is required for pty support 36MinVersion=10.0.17763 37ChangesEnvironment=true 38 39[Languages] 40Name: "english"; MessagesFile: "compiler:Default.isl" 41 42[Tasks] 43Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 44 45[Files] 46Source: "..\target\release\wezterm.exe"; DestDir: "{app}"; Flags: ignoreversion 47Source: "..\target\release\wezterm-gui.exe"; DestDir: "{app}"; Flags: ignoreversion 48Source: "..\target\release\wezterm-mux-server.exe"; DestDir: "{app}"; Flags: ignoreversion 49Source: "..\target\release\mesa\opengl32.dll"; DestDir: "{app}\mesa"; Flags: ignoreversion 50Source: "..\target\release\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion 51Source: "..\target\release\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion 52Source: "..\target\release\conpty.dll"; DestDir: "{app}"; Flags: ignoreversion 53Source: "..\target\release\OpenConsole.exe"; DestDir: "{app}"; Flags: ignoreversion 54Source: "..\target\release\strip-ansi-escapes.exe"; DestDir: "{app}"; Flags: ignoreversion 55; NOTE: Don't use "Flags: ignoreversion" on any shared system files 56 57[Icons] 58Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; AppUserModelID: "org.wezfurlong.wezterm" 59Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; AppUserModelID: "org.wezfurlong.wezterm" 60 61[Run] 62Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 63 64[Registry] 65Root: HKA; Subkey: "Software\Classes\Drive\shell\Open WezTerm here"; Flags: uninsdeletekey 66Root: HKA; Subkey: "Software\Classes\Drive\shell\Open WezTerm here"; ValueName: "icon"; ValueType: string; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey; 67Root: HKA; Subkey: "Software\Classes\Drive\shell\Open WezTerm here\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" start --no-auto-connect --cwd ""%V\"""; Flags: uninsdeletekey; 68Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\Open WezTerm here"; Flags: uninsdeletekey 69Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\Open WezTerm here"; ValueName: "icon"; ValueType: string; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey; 70Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\Open WezTerm here\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" start --no-auto-connect --cwd ""%V"; Flags: uninsdeletekey; 71Root: HKA; Subkey: "Software\Classes\Directory\shell\Open WezTerm here"; Flags: uninsdeletekey 72Root: HKA; Subkey: "Software\Classes\Directory\shell\Open WezTerm here"; ValueName: "icon"; ValueType: string; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey; 73Root: HKA; Subkey: "Software\Classes\Directory\shell\Open WezTerm here\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" start --no-auto-connect --cwd ""%V\\"""; Flags: uninsdeletekey; 74 75[Code] 76{ https://stackoverflow.com/a/46609047/149111 } 77const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; 78 79const IMAGE_FILE_MACHINE_AMD64 = $8664; 80 81function GetMachineTypeAttributes( 82 Machine: Word; var MachineTypeAttributes: Integer): HRESULT; 83 external 'GetMachineTypeAttributes@Kernel32.dll stdcall delayload'; 84 85function IsSupportedArch(): Boolean; 86var 87 Version: TWindowsVersion; 88 MachineTypeAttributes: Integer; 89 Arch: TSetupProcessorArchitecture; 90begin 91 GetWindowsVersionEx(Version); 92 // Use capability detection if available. GetMachineTypeAttributes is 93 // available starting Build 22000 94 if Version.Build >= 22000 then 95 begin 96 OleCheck( 97 GetMachineTypeAttributes(IMAGE_FILE_MACHINE_AMD64, MachineTypeAttributes) 98 ); 99 Result := MachineTypeAttributes <> 0; 100 end 101 else 102 begin 103 // If capability detection is not available, then we rely on build number. 104 // x64 emulation on arm64 is available starting build 21277 so both x64 and 105 // arm64 will work 106 if Version.Build >= 21277 then 107 begin 108 Result := True; 109 end 110 else 111 begin 112 // If we're here, it means we're on a build between 17763 and 21277 113 // because Inno will check MinVersion 10.0.17763 and arch will be x64 or 114 // arm64. Only x64 is supported in this build range 115 Arch := ProcessorArchitecture; 116 Result := Arch = paX64; 117 end 118 end; 119end; 120 121<event('InitializeSetup')> 122function InitializeSetupCheckArchitecture(): Boolean; 123begin 124 Result := IsSupportedArch(); 125end; 126 127procedure EnvAddPath(instlPath: string); 128var 129 Paths: string; 130begin 131 { Retrieve current path (use empty string if entry not exists) } 132 if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then 133 Paths := ''; 134 135 if Paths = '' then 136 Paths := instlPath + ';' 137 else 138 begin 139 { Skip if string already found in path } 140 if Pos(';' + Uppercase(instlPath) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit; 141 if Pos(';' + Uppercase(instlPath) + '\;', ';' + Uppercase(Paths) + ';') > 0 then exit; 142 143 { Append App Install Path to the end of the path variable } 144 if Paths[length(Paths)] <> ';' then 145 Paths := Paths + ';'; 146 147 Paths := Paths + instlPath + ';'; 148 end; 149 150 { Overwrite (or create if missing) path environment variable } 151 if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) 152 then Log(Format('The [%s] added to PATH: [%s]', [instlPath, Paths])) 153 else Log(Format('Error while adding the [%s] to PATH: [%s]', [instlPath, Paths])); 154end; 155 156procedure EnvRemovePath(instlPath: string); 157var 158 Paths: string; 159 P, Offset, DelimLen: Integer; 160begin 161 { Skip if registry entry not exists } 162 if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then 163 exit; 164 165 { Skip if string not found in path } 166 DelimLen := 1; { Length(';') } 167 P := Pos(';' + Uppercase(instlPath) + ';', ';' + Uppercase(Paths) + ';'); 168 if P = 0 then 169 begin 170 { perhaps instlPath lives in Paths, but terminated by '\;' } 171 DelimLen := 2; { Length('\;') } 172 P := Pos(';' + Uppercase(instlPath) + '\;', ';' + Uppercase(Paths) + ';'); 173 if P = 0 then exit; 174 end; 175 176 { Decide where to start string subset in Delete() operation. } 177 if P = 1 then 178 Offset := 0 179 else 180 Offset := 1; 181 { Update path variable } 182 Delete(Paths, P - Offset, Length(instlPath) + DelimLen); 183 184 { Overwrite path environment variable } 185 if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) 186 then Log(Format('The [%s] removed from PATH: [%s]', [instlPath, Paths])) 187 else Log(Format('Error while removing the [%s] from PATH: [%s]', [instlPath, Paths])); 188end; 189 190procedure CurStepChanged(CurStep: TSetupStep); 191begin 192 if CurStep = ssPostInstall then 193 EnvAddPath(ExpandConstant('{app}')); 194end; 195 196procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); 197begin 198 if CurUninstallStep = usPostUninstall then 199 EnvRemovePath(ExpandConstant('{app}')); 200end;