Add uninstaller icons and update packaging scripts
Some checks reported errors
farmcontrol/farmcontrol-ui/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
farmcontrol/farmcontrol-ui/pipeline/head Something is wrong with the build of this commit
- Introduced `uninstaller.ico` and `farmcontroluninstaller.png` assets for the uninstaller. - Updated `farmcontrol.nsi` to define and use the uninstaller icon. - Modified build scripts to copy and handle the uninstaller icon during the packaging process. - Enhanced pre-build script to include the uninstaller icon in the required assets check.
This commit is contained in:
parent
3c4dc329d0
commit
893804a17c
BIN
assets/logos/farmcontroluninstaller.png
Normal file
BIN
assets/logos/farmcontroluninstaller.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 357 KiB |
BIN
assets/uninstaller.ico
Normal file
BIN
assets/uninstaller.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 279 KiB |
@ -31,11 +31,15 @@ SilentInstall normal
|
||||
!define INSTALLER_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
|
||||
!endif
|
||||
|
||||
!ifndef UNINSTALLER_ICON
|
||||
!define UNINSTALLER_ICON "${INSTALLER_ICON}"
|
||||
!endif
|
||||
|
||||
!define MUI_ICON "${INSTALLER_ICON}"
|
||||
!define MUI_UNICON "${INSTALLER_ICON}"
|
||||
!define MUI_UNICON "${UNINSTALLER_ICON}"
|
||||
|
||||
Icon "${INSTALLER_ICON}"
|
||||
UninstallIcon "${INSTALLER_ICON}"
|
||||
UninstallIcon "${UNINSTALLER_ICON}"
|
||||
|
||||
BrandingText "Farm Control v${VERSION}-b${BUILD_NUMBER} Installer"
|
||||
|
||||
|
||||
@ -87,6 +87,12 @@ if (Test-Path $iconPath) {
|
||||
Write-Host "Using installer icon from $iconPath"
|
||||
}
|
||||
|
||||
$uninstallerIconPath = Join-Path $rootDir "assets\uninstaller.ico"
|
||||
if (Test-Path $uninstallerIconPath) {
|
||||
Copy-Item -LiteralPath $uninstallerIconPath -Destination (Join-Path $workDir "uninstaller.ico") -Force
|
||||
Write-Host "Using uninstaller icon from $uninstallerIconPath"
|
||||
}
|
||||
|
||||
$makensis = Find-Makensis
|
||||
$outputExePath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($OutputExe)
|
||||
$outputDir = Split-Path $outputExePath -Parent
|
||||
@ -107,6 +113,10 @@ if (Test-Path (Join-Path $workDir "icon.ico")) {
|
||||
$makensisArgs += "/DINSTALLER_ICON=icon.ico"
|
||||
}
|
||||
|
||||
if (Test-Path (Join-Path $workDir "uninstaller.ico")) {
|
||||
$makensisArgs += "/DUNINSTALLER_ICON=uninstaller.ico"
|
||||
}
|
||||
|
||||
$makensisArgs += (Join-Path $workDir "farmcontrol.nsi")
|
||||
|
||||
Push-Location $workDir
|
||||
|
||||
@ -66,6 +66,7 @@ const requiredIconPaths = [
|
||||
path.join(rootDir, "assets/icon.png"),
|
||||
path.join(rootDir, "assets/icon.iconset/icon_256x256.png"),
|
||||
path.join(rootDir, "assets/installer.ico"),
|
||||
path.join(rootDir, "assets/uninstaller.ico"),
|
||||
];
|
||||
|
||||
if (buildEnv === "stable") {
|
||||
|
||||
@ -9,6 +9,10 @@ const INSTALLER_SOURCE = path.join(
|
||||
rootDir,
|
||||
'assets/logos/farmcontrolinstaller.png'
|
||||
)
|
||||
const UNINSTALLER_SOURCE = path.join(
|
||||
rootDir,
|
||||
'assets/logos/farmcontroluninstaller.png'
|
||||
)
|
||||
|
||||
const MAC_ICONSET_ENTRIES = [
|
||||
{ name: 'icon_16x16.png', size: 16 },
|
||||
@ -38,6 +42,16 @@ async function writePng(filePath, sourceImage, size) {
|
||||
return png
|
||||
}
|
||||
|
||||
async function writeWindowsIco(sourceImage, icoPath) {
|
||||
const icoPngs = []
|
||||
for (const size of WIN_ICO_SIZES) {
|
||||
icoPngs.push(await resizePng(sourceImage, size))
|
||||
}
|
||||
|
||||
await Bun.write(icoPath, await pngToIco(icoPngs))
|
||||
console.log(`prepare-installer-icons: wrote ${icoPath}`)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
if (!existsSync(INSTALLER_SOURCE)) {
|
||||
console.error(
|
||||
@ -46,10 +60,24 @@ async function main() {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const sourceImage = await Jimp.read(INSTALLER_SOURCE)
|
||||
if (sourceImage.width < 256 || sourceImage.height < 256) {
|
||||
if (!existsSync(UNINSTALLER_SOURCE)) {
|
||||
console.error(
|
||||
`prepare-installer-icons: source image not found: ${UNINSTALLER_SOURCE}`
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const installerImage = await Jimp.read(INSTALLER_SOURCE)
|
||||
if (installerImage.width < 256 || installerImage.height < 256) {
|
||||
console.warn(
|
||||
`prepare-installer-icons: source image is ${sourceImage.width}x${sourceImage.height}; recommend at least 256x256`
|
||||
`prepare-installer-icons: installer source is ${installerImage.width}x${installerImage.height}; recommend at least 256x256`
|
||||
)
|
||||
}
|
||||
|
||||
const uninstallerImage = await Jimp.read(UNINSTALLER_SOURCE)
|
||||
if (uninstallerImage.width < 256 || uninstallerImage.height < 256) {
|
||||
console.warn(
|
||||
`prepare-installer-icons: uninstaller source is ${uninstallerImage.width}x${uninstallerImage.height}; recommend at least 256x256`
|
||||
)
|
||||
}
|
||||
|
||||
@ -63,21 +91,17 @@ async function main() {
|
||||
for (const entry of MAC_ICONSET_ENTRIES) {
|
||||
await writePng(
|
||||
path.join(iconsetDir, entry.name),
|
||||
sourceImage,
|
||||
installerImage,
|
||||
entry.size
|
||||
)
|
||||
}
|
||||
|
||||
const icoPngs = []
|
||||
for (const size of WIN_ICO_SIZES) {
|
||||
icoPngs.push(await resizePng(sourceImage, size))
|
||||
}
|
||||
|
||||
const icoPath = path.join(assetsDir, 'installer.ico')
|
||||
await Bun.write(icoPath, await pngToIco(icoPngs))
|
||||
|
||||
console.log(`prepare-installer-icons: wrote ${iconsetDir}`)
|
||||
console.log(`prepare-installer-icons: wrote ${icoPath}`)
|
||||
await writeWindowsIco(installerImage, path.join(assetsDir, 'installer.ico'))
|
||||
await writeWindowsIco(
|
||||
uninstallerImage,
|
||||
path.join(assetsDir, 'uninstaller.ico')
|
||||
)
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user