修复桌面应用图标并适配多语言名称
This commit is contained in:
1 parent
17deffcfb5
commit
1a9be54355
9 files changed
+107
-7
No files matched your search
@@ -223,6 +223,7 @@ jobs:
|
||||
- name: 编译 Windows 桌面程序
|
||||
shell: pwsh
|
||||
run: |
|
||||
& packaging/windows/build-resources.ps1
|
||||
New-Item -ItemType Directory -Force -Path dist/windows | Out-Null
|
||||
go build -trimpath -ldflags "-s -w" -o dist/windows/xianyu-server.exe ./cmd/server
|
||||
go build -trimpath -ldflags "-s -w" -o dist/windows/browser-install.exe ./cmd/browser-install
|
||||
@@ -509,6 +510,25 @@ jobs:
|
||||
if (-not (Test-Path -LiteralPath $uninstaller -PathType Leaf)) {
|
||||
throw "Windows 卸载器不存在: $uninstaller"
|
||||
}
|
||||
$expectedTray = Join-Path $installDir 'xianyu-tray.exe'
|
||||
$startMenuRoots = @(
|
||||
(Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs'),
|
||||
(Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs')
|
||||
)
|
||||
$startMenuShortcut = $startMenuRoots |
|
||||
Where-Object { Test-Path -LiteralPath $_ -PathType Container } |
|
||||
ForEach-Object {
|
||||
Get-ChildItem -LiteralPath $_ -Filter '*.lnk' -Recurse -File -ErrorAction SilentlyContinue
|
||||
} |
|
||||
Where-Object {
|
||||
$shortcutShell = New-Object -ComObject WScript.Shell
|
||||
$shortcutTarget = $shortcutShell.CreateShortcut($_.FullName).TargetPath
|
||||
[StringComparer]::OrdinalIgnoreCase.Equals($shortcutTarget, $expectedTray)
|
||||
} |
|
||||
Select-Object -First 1
|
||||
if ($null -eq $startMenuShortcut) {
|
||||
throw '安装器未创建开始菜单快捷方式'
|
||||
}
|
||||
} catch {
|
||||
if (Test-Path -LiteralPath $installLog) {
|
||||
Get-Content -LiteralPath $installLog -Tail 200
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
*.test
|
||||
!/Dockerfile.test
|
||||
*.out
|
||||
/cmd/server/rsrc_windows_amd64.syso
|
||||
/cmd/tray/rsrc_windows_amd64.syso
|
||||
|
||||
# Local deployment environment (keep secrets out of Git)
|
||||
/.env
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.ydisks.xianyu-helper</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Ydisks闲鱼助手</string>
|
||||
<string>Ydisks Xianyu Helper</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Ydisks闲鱼助手</string>
|
||||
<string>Ydisks Xianyu Helper</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/* English application display name. */
|
||||
"CFBundleName" = "Ydisks Xianyu Helper";
|
||||
"CFBundleDisplayName" = "Ydisks Xianyu Helper";
|
||||
@@ -0,0 +1,3 @@
|
||||
/* Simplified Chinese application display name. */
|
||||
"CFBundleName" = "Ydisks闲鱼助手";
|
||||
"CFBundleDisplayName" = "Ydisks闲鱼助手";
|
||||
@@ -0,0 +1,3 @@
|
||||
/* Chinese application display name. */
|
||||
"CFBundleName" = "Ydisks闲鱼助手";
|
||||
"CFBundleDisplayName" = "Ydisks闲鱼助手";
|
||||
@@ -60,6 +60,15 @@ mkdir -p "$APP/Contents/Resources/playwright-runtime/$ARCH"
|
||||
cp -R "$DIST_DIR/playwright-runtime/$ARCH/." "$APP/Contents/Resources/playwright-runtime/$ARCH/"
|
||||
cp "$PROJECT_ROOT/icon/macos/Assets.car" "$APP/Contents/Resources/Assets.car"
|
||||
cp "$PROJECT_ROOT/icon/macos/icon.icns" "$APP/Contents/Resources/icon.icns"
|
||||
mkdir -p "$APP/Contents/Resources/en.lproj" \
|
||||
"$APP/Contents/Resources/zh-Hans.lproj" \
|
||||
"$APP/Contents/Resources/zh-Hant.lproj"
|
||||
cp "$SCRIPT_DIR/Resources/en.lproj/InfoPlist.strings" \
|
||||
"$APP/Contents/Resources/en.lproj/InfoPlist.strings"
|
||||
cp "$SCRIPT_DIR/Resources/zh-Hans.lproj/InfoPlist.strings" \
|
||||
"$APP/Contents/Resources/zh-Hans.lproj/InfoPlist.strings"
|
||||
cp "$SCRIPT_DIR/Resources/zh-Hant.lproj/InfoPlist.strings" \
|
||||
"$APP/Contents/Resources/zh-Hant.lproj/InfoPlist.strings"
|
||||
sed "s/__VERSION__/$VERSION/g" "$SCRIPT_DIR/Info.plist" > "$APP/Contents/Info.plist"
|
||||
chmod 0755 "$APP/Contents/MacOS/Ydisks闲鱼助手" "$APP/Contents/Helpers/xianyu-server" "$APP_DIR/卸载 Ydisks闲鱼助手.command"
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
$iconPath = (Resolve-Path (Join-Path $repoRoot 'icon\windows\icon.ico')).Path
|
||||
$winresTool = 'github.com/tc-hib/go-winres@v0.3.3'
|
||||
|
||||
$resourceSpecs = @(
|
||||
@{ Package = 'cmd\server'; Output = 'rsrc'; Manifest = 'cli'; Description = 'Ydisks Xianyu Helper server'; Filename = 'xianyu-server.exe' },
|
||||
@{ Package = 'cmd\tray'; Output = 'rsrc'; Manifest = 'gui'; Description = 'Ydisks Xianyu Helper tray'; Filename = 'xianyu-tray.exe' }
|
||||
)
|
||||
|
||||
foreach ($spec in $resourceSpecs) {
|
||||
$outputPrefix = Join-Path $repoRoot (Join-Path $spec.Package $spec.Output)
|
||||
$outputFile = "${outputPrefix}_windows_amd64.syso"
|
||||
Remove-Item -LiteralPath $outputFile -Force -ErrorAction SilentlyContinue
|
||||
|
||||
& go run $winresTool simply `
|
||||
--arch amd64 `
|
||||
--out $outputPrefix `
|
||||
--manifest $spec.Manifest `
|
||||
--icon $iconPath `
|
||||
--product-name 'Ydisks Xianyu Helper' `
|
||||
--file-description $spec.Description `
|
||||
--original-filename $spec.Filename
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "生成 Windows 资源失败: $($spec.Package)"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $outputFile -PathType Leaf)) {
|
||||
throw "Windows 资源文件未生成: $outputFile"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
#define AppName "Ydisks Xianyu Helper"
|
||||
#define AppVersion GetEnv("APP_VERSION")
|
||||
#define AppPublisher "Christ9038"
|
||||
#define AppExeName "xianyu-server.exe"
|
||||
@@ -10,11 +9,11 @@
|
||||
|
||||
[Setup]
|
||||
AppId={{A6E8B04B-3C8A-4E20-AE62-6B1C3F6B31AE}
|
||||
AppName={#AppName}
|
||||
AppName={cm:ProductName}
|
||||
AppVersion={#AppVersion}
|
||||
AppPublisher={#AppPublisher}
|
||||
DefaultDirName={autopf}\Ydisks Xianyu Helper
|
||||
DefaultGroupName={#AppName}
|
||||
DefaultDirName={autopf}\{cm:ProductName}
|
||||
DefaultGroupName={cm:ProductName}
|
||||
OutputBaseFilename=Ydisks-Xianyu-Helper-Setup
|
||||
PrivilegesRequired=admin
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
@@ -24,6 +23,28 @@ SetupIconFile={#WindowsIconDir}\icon.ico
|
||||
Compression=lzma2
|
||||
SolidCompression=yes
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||
Name: "chinesetraditional"; MessagesFile: "compiler:Languages\ChineseTraditional.isl"
|
||||
|
||||
[CustomMessages]
|
||||
english.ProductName=Ydisks Xianyu Helper
|
||||
chinesesimplified.ProductName=Ydisks闲鱼助手
|
||||
chinesetraditional.ProductName=Ydisks闲鱼助手
|
||||
english.StartMenuShortcut=Create a Start Menu shortcut
|
||||
chinesesimplified.StartMenuShortcut=创建开始菜单快捷方式
|
||||
chinesetraditional.StartMenuShortcut=创建开始菜单快捷方式
|
||||
english.DesktopShortcut=Create a desktop shortcut
|
||||
chinesesimplified.DesktopShortcut=创建桌面快捷方式
|
||||
chinesetraditional.DesktopShortcut=创建桌面快捷方式
|
||||
english.ShortcutOptions=Shortcut options:
|
||||
chinesesimplified.ShortcutOptions=快捷方式选项:
|
||||
chinesetraditional.ShortcutOptions=快捷方式选项:
|
||||
english.StartTray=Start tray controller
|
||||
chinesesimplified.StartTray=启动托盘控制器
|
||||
chinesetraditional.StartTray=启动托盘控制器
|
||||
|
||||
[Files]
|
||||
Source: "{#WindowsDistDir}\xianyu-server.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "{#WindowsDistDir}\xianyu-tray.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
@@ -40,8 +61,16 @@ Name: "{#AppDataDir}\logs"; Permissions: users-modify
|
||||
[Registry]
|
||||
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "YdisksXianyuHelperTray"; ValueData: """{app}\xianyu-tray.exe"""; Flags: uninsdeletevalue
|
||||
|
||||
[Tasks]
|
||||
Name: "startmenuicon"; Description: "{cm:StartMenuShortcut}"; GroupDescription: "{cm:ShortcutOptions}"
|
||||
Name: "desktopicon"; Description: "{cm:DesktopShortcut}"; GroupDescription: "{cm:ShortcutOptions}"; Flags: unchecked
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{cm:ProductName}"; Filename: "{app}\xianyu-tray.exe"; WorkingDir: "{app}"; IconFilename: "{app}\icon.ico"; Tasks: startmenuicon
|
||||
Name: "{autodesktop}\{cm:ProductName}"; Filename: "{app}\xianyu-tray.exe"; WorkingDir: "{app}"; IconFilename: "{app}\icon.ico"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\xianyu-tray.exe"; Description: "启动菜单栏控制器"; Flags: nowait postinstall skipifsilent runasoriginaluser; Check: ServiceStartedSuccessfully
|
||||
Filename: "{app}\xianyu-tray.exe"; Description: "{cm:StartTray}"; Flags: nowait postinstall skipifsilent runasoriginaluser; Check: ServiceStartedSuccessfully
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File ""{app}\service-control.ps1"" -Mode uninstall -TrayPath ""{app}\xianyu-tray.exe"""; Flags: runhidden waituntilterminated
|
||||
|
||||
Reference in new issue
Block a user