@@ -76,7 +76,9 @@ function openLocal() {
7676
7777function buildTray ( ) {
7878 // Tray-only app: no windows, just menu actions.
79- const iconPath = path . join ( getAppRoot ( ) , 'public' , 'assets' , 'favicon-16x16.png' ) ;
79+ const iconPath = process . platform === 'win32'
80+ ? path . join ( getAppRoot ( ) , 'public' , 'assets' , 'favicon.ico' )
81+ : path . join ( getAppRoot ( ) , 'public' , 'assets' , 'favicon-16x16.png' ) ;
8082 const baseIcon = nativeImage . createFromPath ( iconPath ) ;
8183 const targetSize = process . platform === 'darwin' ? 16 : 24 ;
8284 const trayIcon = baseIcon . isEmpty ( )
@@ -145,7 +147,7 @@ function checkForUpdatesWithFeedback() {
145147 showUpdateMessage ( {
146148 type : 'info' ,
147149 message : 'Update available' ,
148- detail : 'Update available. Downloading...'
150+ detail : 'Downloading update ...'
149151 } ) ;
150152 finish ( ) ;
151153 } ;
@@ -198,30 +200,10 @@ function checkForUpdatesInBackground() {
198200 } ) ;
199201}
200202
201- async function getCachedUpdateFileName ( cacheDir ) {
202- const infoPath = path . join ( cacheDir , 'update-info.json' ) ;
203- try {
204- const raw = await fs . promises . readFile ( infoPath , 'utf8' ) ;
205- const info = JSON . parse ( raw ) ;
206- if ( info && typeof info . fileName === 'string' && info . fileName ) {
207- return info . fileName ;
208- }
209- } catch ( error ) {
210- if ( ! ( error && error . code === 'ENOENT' ) ) {
211- console . error ( '[Updater] Cache cleanup failed:' , error && error . message ? error . message : String ( error ) ) ;
212- }
213- }
214- return null ;
215- }
216-
217- async function cleanupOldUpdateCaches ( { downloadedFile, pendingDir } ) {
218- const cacheDir = pendingDir || ( downloadedFile ? path . dirname ( downloadedFile ) : null ) ;
219- if ( ! cacheDir ) return ;
220-
221- const updateFileName = downloadedFile
222- ? path . basename ( downloadedFile )
223- : await getCachedUpdateFileName ( cacheDir ) ;
224- if ( ! updateFileName ) return ;
203+ async function cleanupOldUpdateCaches ( downloadedFile ) {
204+ if ( ! downloadedFile ) return ;
205+ const cacheDir = path . dirname ( downloadedFile ) ;
206+ const updateFileName = path . basename ( downloadedFile ) ;
225207 const keepNames = new Set ( ) ;
226208 keepNames . add ( 'update-info.json' ) ;
227209 keepNames . add ( 'current.blockmap' ) ;
@@ -237,9 +219,8 @@ async function cleanupOldUpdateCaches({ downloadedFile, pendingDir }) {
237219 return ;
238220 }
239221
240- const shouldKeep = keepNames . size > 0 ;
241222 await Promise . all ( entries . map ( async ( entry ) => {
242- if ( shouldKeep && ( keepNames . has ( entry . name ) || entry . name . startsWith ( 'package-' ) ) ) return ;
223+ if ( keepNames . has ( entry . name ) || entry . name . startsWith ( 'package-' ) ) return ;
243224 const entryPath = path . join ( cacheDir , entry . name ) ;
244225 try {
245226 await fs . promises . rm ( entryPath , { recursive : true , force : true } ) ;
@@ -249,18 +230,6 @@ async function cleanupOldUpdateCaches({ downloadedFile, pendingDir }) {
249230 } ) ) ;
250231}
251232
252- async function cleanupUpdateCachesOnLaunch ( ) {
253- if ( ! app . isPackaged ) return ;
254- if ( typeof autoUpdater . getOrCreateDownloadHelper !== 'function' ) return ;
255- try {
256- const helper = await autoUpdater . getOrCreateDownloadHelper ( ) ;
257- if ( ! helper || ! helper . cacheDirForPendingUpdate ) return ;
258- await cleanupOldUpdateCaches ( { pendingDir : helper . cacheDirForPendingUpdate } ) ;
259- } catch ( error ) {
260- console . error ( '[Updater] Cache cleanup failed:' , error && error . message ? error . message : String ( error ) ) ;
261- }
262- }
263-
264233async function showUpdateReadyDialog ( ) {
265234 if ( ! updateReadyInfo ) return ;
266235 const result = await dialog . showMessageBox ( {
@@ -280,11 +249,10 @@ function setupAutoUpdater() {
280249 // Updates only work for packaged builds with GitHub Releases.
281250 if ( ! app . isPackaged ) return ;
282251 autoUpdater . autoDownload = true ;
283- cleanupUpdateCachesOnLaunch ( ) ;
284252 autoUpdater . on ( 'update-downloaded' , async ( info ) => {
285253 updateReadyInfo = info || { version : 'unknown' } ;
286254 updateTrayMenu ( ) ;
287- await cleanupOldUpdateCaches ( { downloadedFile : info && info . downloadedFile } ) ;
255+ await cleanupOldUpdateCaches ( info && info . downloadedFile ) ;
288256 } ) ;
289257 autoUpdater . on ( 'error' , ( error ) => {
290258 const detail = error && error . message ? error . message : String ( error ) ;
0 commit comments