Skip to content

Commit 03f9f8d

Browse files
committed
updated launcher windows package
1 parent a59ce23 commit 03f9f8d

5 files changed

Lines changed: 70 additions & 29 deletions

File tree

.github/workflows/build-launcher-installer.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ jobs:
4242
- name: Copy launcher JAR and icon to staging
4343
run: |
4444
Copy-Item launcher\build\libs\woodlanders-launcher.jar -Destination installer-staging\
45-
if (Test-Path assets\icon\icon.png) {
46-
Copy-Item assets\icon\icon.png -Destination installer-staging\launcher.ico
45+
if (Test-Path assets\icon\icon.ico) {
46+
Copy-Item assets\icon\icon.ico -Destination installer-staging\launcher.ico
47+
} elseif (Test-Path assets\icon\icon.png) {
48+
Copy-Item assets\icon\icon.png -Destination installer-staging\launcher.png
4749
}
4850
4951
- name: Create installer script from template
@@ -140,12 +142,14 @@ jobs:
140142
Copy-Item installer-staging\launcher.ico -Destination build\distributions\ -Force -ErrorAction SilentlyContinue
141143
Copy-Item installer-staging\install.ps1 -Destination build\distributions\ -Force
142144
Copy-Item installer-staging\README.txt -Destination build\distributions\ -Force
145+
Copy-Item launcher\uninstall.ps1 -Destination build\distributions\ -Force
143146
144147
$zipFiles = @(
145148
"build\distributions\woodlanders-setup-launcher.exe",
146149
"build\distributions\woodlanders-launcher.jar",
147150
"build\distributions\launcher.ico",
148151
"build\distributions\install.ps1",
152+
"build\distributions\uninstall.ps1",
149153
"build\distributions\README.txt"
150154
)
151155
$zipFiles = $zipFiles | Where-Object { Test-Path $_ }

assets/icon/icon.ico

202 KB
Binary file not shown.

assets/icon/icon.png

10.3 KB
Loading

launcher/build-launcher-installer-local.ps1

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ if (Test-Path launcher\build\libs\woodlanders-launcher.jar) {
3535
exit 1
3636
}
3737

38-
# Copy icon if it exists (rename to match template expectations)
39-
if (Test-Path assets\icon\icon.png) {
40-
Copy-Item assets\icon\icon.png -Destination installer-staging\launcher.ico
41-
Write-Host "Icon copied" -ForegroundColor Green
38+
# Copy icon (use .ico for Windows)
39+
if (Test-Path assets\icon\icon.ico) {
40+
Copy-Item assets\icon\icon.ico -Destination installer-staging\launcher.ico
41+
Write-Host "Icon copied (.ico)" -ForegroundColor Green
42+
} elseif (Test-Path assets\icon\icon.png) {
43+
Copy-Item assets\icon\icon.png -Destination installer-staging\launcher.png
44+
Write-Host "Icon copied (.png)" -ForegroundColor Green
4245
} else {
4346
Write-Host "Icon not found (optional)" -ForegroundColor Yellow
4447
}
@@ -142,8 +145,10 @@ function Install-Application {
142145
Write-ErrorMsg "Application JAR not found"
143146
return $false
144147
}
145-
if (Test-Path "$scriptDir\launcher-icon.png") {
146-
Copy-Item "$scriptDir\launcher-icon.png" -Destination $INSTALL_DIR -Force
148+
if (Test-Path "$scriptDir\launcher.ico") {
149+
Copy-Item "$scriptDir\launcher.ico" -Destination $INSTALL_DIR -Force
150+
} elseif (Test-Path "$scriptDir\launcher.png") {
151+
Copy-Item "$scriptDir\launcher.png" -Destination $INSTALL_DIR -Force
147152
}
148153
return $true
149154
}
@@ -160,8 +165,8 @@ function New-Shortcuts {
160165
$Shortcut.TargetPath = "$INSTALL_DIR\launcher.bat"
161166
$Shortcut.WorkingDirectory = $INSTALL_DIR
162167
$Shortcut.Description = "Woodlanders Game Launcher"
163-
if (Test-Path "$INSTALL_DIR\launcher-icon.png") {
164-
$Shortcut.IconLocation = "$INSTALL_DIR\launcher-icon.png"
168+
if (Test-Path "$INSTALL_DIR\launcher.ico") {
169+
$Shortcut.IconLocation = "$INSTALL_DIR\launcher.ico"
165170
}
166171
$Shortcut.Save()
167172
Write-Success "Desktop shortcut created"
@@ -170,8 +175,8 @@ function New-Shortcuts {
170175
$StartMenuShortcut.TargetPath = "$INSTALL_DIR\launcher.bat"
171176
$StartMenuShortcut.WorkingDirectory = $INSTALL_DIR
172177
$StartMenuShortcut.Description = "Woodlanders Game Launcher"
173-
if (Test-Path "$INSTALL_DIR\launcher-icon.png") {
174-
$StartMenuShortcut.IconLocation = "$INSTALL_DIR\launcher-icon.png"
178+
if (Test-Path "$INSTALL_DIR\launcher.ico") {
179+
$StartMenuShortcut.IconLocation = "$INSTALL_DIR\launcher.ico"
175180
}
176181
$StartMenuShortcut.Save()
177182
Write-Success "Start Menu shortcut created"
@@ -293,15 +298,18 @@ Write-Host "[7/7] Creating distribution package..." -ForegroundColor Yellow
293298
# Copy all necessary files to distributions folder
294299
Copy-Item installer-staging\woodlanders-launcher.jar -Destination build\distributions\ -Force
295300
Copy-Item installer-staging\launcher.ico -Destination build\distributions\ -Force -ErrorAction SilentlyContinue
301+
Copy-Item installer-staging\launcher.png -Destination build\distributions\ -Force -ErrorAction SilentlyContinue
296302
Copy-Item installer-staging\install.ps1 -Destination build\distributions\ -Force
297303
Copy-Item installer-staging\README.txt -Destination build\distributions\ -Force
304+
Copy-Item launcher\uninstall.ps1 -Destination build\distributions\ -Force
298305

299306
# Create ZIP with all installer files
300307
$zipFiles = @(
301308
"build\distributions\woodlanders-setup-launcher.exe",
302309
"build\distributions\woodlanders-launcher.jar",
303310
"build\distributions\launcher.ico",
304311
"build\distributions\install.ps1",
312+
"build\distributions\uninstall.ps1",
305313
"build\distributions\README.txt"
306314
)
307315
$zipFiles = $zipFiles | Where-Object { Test-Path $_ }
@@ -336,20 +344,5 @@ Write-Host " 1. Extract the ZIP file" -ForegroundColor White
336344
Write-Host " 2. Run woodlanders-setup-launcher.exe from the extracted folder" -ForegroundColor White
337345
Write-Host ""
338346

339-
$test = Read-Host "Would you like to extract and test the installer now? (Y/n)"
340-
if ($test -ne 'n' -and $test -ne 'N') {
341-
Write-Host ""
342-
Write-Host "Extracting ZIP..." -ForegroundColor Cyan
343-
$testDir = "build\distributions\test-installer"
344-
if (Test-Path $testDir) { Remove-Item $testDir -Recurse -Force }
345-
346-
# Try Expand-Archive first, fallback to .NET if module not available
347-
try {
348-
Expand-Archive -Path build\distributions\woodlanders-launcher-installer.zip -DestinationPath $testDir -ErrorAction Stop
349-
} catch {
350-
Add-Type -AssemblyName System.IO.Compression.FileSystem
351-
[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD\build\distributions\woodlanders-launcher-installer.zip", "$PWD\$testDir")
352-
}
353-
Write-Host "Launching installer..." -ForegroundColor Cyan
354-
Start-Process -FilePath "$testDir\woodlanders-setup-launcher.exe" -WorkingDirectory $testDir -Wait
355-
}
347+
Write-Host "Build complete! Run the installer from:" -ForegroundColor Cyan
348+
Write-Host " build\distributions\test-installer\woodlanders-setup-launcher.exe" -ForegroundColor White

launcher/uninstall.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Woodlanders Launcher - Uninstaller
2+
$ErrorActionPreference = "Continue"
3+
4+
Write-Host ""
5+
Write-Host "Woodlanders Launcher Uninstaller" -ForegroundColor Cyan
6+
Write-Host ""
7+
8+
$confirm = Read-Host "This will remove all Woodlanders Launcher files and shortcuts. Continue? (Y/n)"
9+
if ($confirm -eq 'n' -or $confirm -eq 'N') {
10+
Write-Host "Uninstall cancelled" -ForegroundColor Yellow
11+
exit 0
12+
}
13+
14+
Write-Host ""
15+
Write-Host "Removing Woodlanders files..." -ForegroundColor Yellow
16+
17+
# Remove main installation directory
18+
if (Test-Path "$env:LOCALAPPDATA\Woodlanders") {
19+
Remove-Item "$env:LOCALAPPDATA\Woodlanders" -Recurse -Force -ErrorAction SilentlyContinue
20+
Write-Host "✓ Installation directory removed" -ForegroundColor Green
21+
}
22+
23+
# Remove desktop shortcut
24+
if (Test-Path "$env:USERPROFILE\Desktop\Woodlanders Launcher.lnk") {
25+
Remove-Item "$env:USERPROFILE\Desktop\Woodlanders Launcher.lnk" -Force -ErrorAction SilentlyContinue
26+
Write-Host "✓ Desktop shortcut removed" -ForegroundColor Green
27+
}
28+
29+
# Remove Start Menu folder
30+
if (Test-Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Woodlanders") {
31+
Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Woodlanders" -Recurse -Force -ErrorAction SilentlyContinue
32+
Write-Host "✓ Start Menu entry removed" -ForegroundColor Green
33+
}
34+
35+
# Remove JavaFX cache
36+
if (Test-Path "$env:USERPROFILE\.cache\woodlanders-javafx") {
37+
Remove-Item "$env:USERPROFILE\.cache\woodlanders-javafx" -Recurse -Force -ErrorAction SilentlyContinue
38+
Write-Host "✓ JavaFX cache removed" -ForegroundColor Green
39+
}
40+
41+
Write-Host ""
42+
Write-Host "Uninstall complete!" -ForegroundColor Green
43+
Write-Host ""
44+
Read-Host "Press Enter to exit"

0 commit comments

Comments
 (0)