-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-installer.ps1
More file actions
61 lines (50 loc) · 1.53 KB
/
Copy pathbuild-installer.ps1
File metadata and controls
61 lines (50 loc) · 1.53 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
param(
[string]$Version = "0.1.2",
[string]$InnoSetupCompiler = ""
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
$issPath = Join-Path $root "installer.iss"
if (-not (Test-Path -LiteralPath $issPath)) {
throw "Missing installer script: $issPath"
}
$required = @(
"MdPaste.exe",
"_internal\pandoc\pandoc.exe",
"MDPASTE.cmd",
"MdPaste-portable.cmd",
"portable-config.ps1",
"assets\icons\logo.ico"
)
foreach ($item in $required) {
$path = Join-Path $root $item
if (-not (Test-Path -LiteralPath $path)) {
throw "Missing required installer input: $item"
}
}
if (-not $InnoSetupCompiler) {
$candidates = @(
"F:\InnoSetup6\ISCC.exe",
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe",
"$env:ProgramFiles\Inno Setup 5\ISCC.exe"
)
foreach ($candidate in $candidates) {
if ($candidate -and (Test-Path -LiteralPath $candidate)) {
$InnoSetupCompiler = $candidate
break
}
}
}
if (-not $InnoSetupCompiler) {
throw "Inno Setup compiler was not found. Install it with: winget install JRSoftware.InnoSetup"
}
if (-not (Test-Path -LiteralPath $InnoSetupCompiler)) {
throw "Inno Setup compiler not found: $InnoSetupCompiler"
}
& $InnoSetupCompiler "/DAppVersion=$Version" $issPath
if ($LASTEXITCODE -ne 0) {
throw "Inno Setup failed with exit code $LASTEXITCODE"
}
Write-Host "[OK] Installer created: $(Join-Path $root "dist\MDPASTE-Setup-v$Version.exe")"