()
| 65 | * the NSIS-installed registry entry with the old version. |
| 66 | */ |
| 67 | export async function syncWindowsUninstallVersion(): Promise<void> { |
| 68 | if (process.platform !== 'win32') return |
| 69 | if (!app.isPackaged) return |
| 70 | |
| 71 | const currentVersion = app.getVersion() |
| 72 | const productName = app.getName() |
| 73 | |
| 74 | try { |
| 75 | const keyPath = await findUninstallKeyPath(productName) |
| 76 | if (!keyPath) { |
| 77 | console.log('[RegistrySync] No uninstall registry entry found (portable install?)') |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | const registryVersion = await getRegistryValue(keyPath, 'DisplayVersion') |
| 82 | if (registryVersion === currentVersion) return |
| 83 | |
| 84 | const success = await setRegistryValue(keyPath, 'DisplayVersion', currentVersion) |
| 85 | if (success) { |
| 86 | console.log(`[RegistrySync] Updated DisplayVersion: ${registryVersion} -> ${currentVersion}`) |
| 87 | } else { |
| 88 | console.warn('[RegistrySync] Failed to update DisplayVersion (insufficient permissions?)') |
| 89 | } |
| 90 | } catch (error) { |
| 91 | console.error('[RegistrySync] Error syncing registry version:', error) |
| 92 | } |
| 93 | } |
no test coverage detected