An open-source cross-platform alternative to AirDrop
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Copy the contents of the zip to D:\inno, then run this Inno script
; Copy app/assets/packaging/logo.ico to D:\inno\logo.ico
; Payload/output directories, overridable from CI via /DPayloadDir=... /DResultDir=...
#ifndef PayloadDir
#define PayloadDir "D:\inno"
#endif
#ifndef ResultDir
#define ResultDir "D:\inno-result"
#endif
#define MyAppName "LocalSend"
#define MyAppVersion "1.19.0"
#define MyAppPublisher "Tien Do Nam"
#define MyAppURL "https://localsend.org"
#define MyAppExeName "localsend_app.exe"
#define MyAppMsixHelper "localsend_msix_helper.msix"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{00809252-FEC6-448E-83B4-E7F55AE7E47D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir={#ResultDir}
OutputBaseFilename=localsend
SetupIconFile={#PayloadDir}\logo.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
Compression=lzma
SolidCompression=yes
WizardStyle=modern
; Sign at compile time: the uninstaller is embedded during compilation, so signing the finished
; installer afterwards would leave it unsigned. CI defines the command via "iscc /SMySignTool=...";
; deliberately unsigned builds pass /DSkipSignTool.
#ifndef SkipSignTool
SignTool=MySignTool
#endif
ArchitecturesInstallIn64BitMode=x64compatible
ArchitecturesAllowed=x64compatible
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "bulgarian"; MessagesFile: "compiler:Languages\Bulgarian.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
; Icelandic was reclassified as unofficial in Inno Setup 6.5.0 (no maintainer) and is no longer bundled, so it is vendored like ChineseSimplified
Name: "icelandic"; MessagesFile: "..\build\windows\inno\Icelandic.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
Name: "chinesesimplified"; MessagesFile: "..\build\windows\inno\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#PayloadDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs
; Unsigned builds pass /DSkipMsixHelper: Add-AppxPackage rejects unsigned packages, so ship without the MSIX helper (like the portable zip)
#ifndef SkipMsixHelper
Source: "{#PayloadDir}\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\{#MyAppMsixHelper}"; DestDir: "{app}"; Flags: ignoreversion
; Windows reads the share icons from the app's install folder. Copy their images and resource index (resources.pri) there.
Source: "..\build\msix\content\Images\*"; DestDir: "{app}\Images"; Flags: ignoreversion
Source: "..\build\msix\content\resources.pri"; DestDir: "{app}"; Flags: ignoreversion
#endif
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
#ifndef SkipMsixHelper
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -Command Add-AppxPackage .\localsend_msix_helper.msix -ExternalLocation $(Get-Location)"; WorkingDir: {app}; Flags: nowait runhidden
#endif
[UninstallRun]
; [UninstallRun] runs before any file is removed. LocalSend may still be running (e.g. hidden in the tray after autostart),
; which would keep its exe and DLLs in use. Terminate the instances started from this installation, also those of other users.
Filename: "powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -Command ""$exe = Join-Path $PWD.Path '{#MyAppExeName}'; Get-Process localsend_app -ErrorAction SilentlyContinue | Where-Object Path -eq $exe | ForEach-Object {{ $_.Kill(); $_.WaitForExit(10000) }"""; WorkingDir: {app}; Flags: runhidden waituntilterminated; RunOnceId: "CloseApp"
; The app itself, not this installer, creates the "Send to" shortcut on its first start (context_menu_helper.dart). Remove it if it
; starts this installation. This runs in 64-bit PowerShell because a 32-bit process, like the uninstaller, reads a shortcut
; into C:\Program Files as C:\Program Files (x86).
Filename: "powershell.exe"; Parameters: "-NoProfile -ExecutionPolicy Bypass -Command ""$exe = Join-Path $PWD.Path '{#MyAppExeName}'; $lnk = Join-Path ([Environment]::GetFolderPath('SendTo')) '{#MyAppName}.lnk'; if ((Test-Path -LiteralPath $lnk) -and (New-Object -ComObject WScript.Shell).CreateShortcut($lnk).TargetPath -eq $exe) {{ Remove-Item -LiteralPath $lnk }"""; WorkingDir: {app}; Flags: runhidden waituntilterminated; RunOnceId: "RemoveSendToShortcut"
; Windows adds firewall rules for the exe when the user allows access on the first start. Removing them requires admin rights.
Filename: "{sys}\netsh.exe"; Parameters: "advfirewall firewall delete rule name=all program=""{app}\{#MyAppExeName}"""; Flags: runhidden waituntilterminated; Check: IsAdminInstallMode; RunOnceId: "DeleteFirewallRules"
#ifndef SkipMsixHelper
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -Command Get-AppxPackage LocalSend.App | Remove-AppxPackage"; Flags: nowait runhidden
#endif
[Code]
const
RunKey = 'Software\Microsoft\Windows\CurrentVersion\Run';
RunValue = 'LocalSend';
function IsAppExe(Path: String): Boolean;
begin
Result := CompareText(Path, ExpandConstant('{app}\{#MyAppExeName}')) = 0;
end;
// The exe of a command line like "C:\Program Files\LocalSend\localsend_app.exe" --hidden
function CommandExe(Command: String): String;
var
P: Integer;
begin
Result := Trim(Command);
if (Length(Result) > 0) and (Result[1] = '"') then
begin
Delete(Result, 1, 1);
P := Pos('"', Result);
if P > 0 then
Result := Copy(Result, 1, P - 1);
end;
end;
// The app itself, not this installer, adds the autostart value (autostart_helper.dart). Remove it if it starts this
// installation, so that it doesn't start a missing exe at every sign-in. It belongs to the user running the uninstaller.
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Value: String;
begin
if (CurUninstallStep = usPostUninstall) and RegQueryStringValue(HKCU, RunKey, RunValue, Value) and IsAppExe(CommandExe(Value)) then
RegDeleteValue(HKCU, RunKey, RunValue);
end;