-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: Update version number in Add/Remove Programs on update #4454
Comments
It looks like we'd need to update Mozilla seems to do this with the maintenance service, which doesn't help us: But we could theoretically do this with http://udn.realityripple.com/docs/Mozilla/Tech/XPCOM/Accessing_the_Windows_Registry_Using_XPCOm I guess we could do it on startup when the current |
We have some example code using this https://github.com/zotero/zotero-word-for-windows-integration/blob/master/resource/installer.jsm#L75 |
Just a minor point, but is there an easy way to make the update happen directly after installation? If the auto-update happens without a restart, the installed and reported-by-ARP versions are out of sync until the next restart. |
Updates happen on restart, so the new version always starts up immediately. |
Except we can't actually do this in the app itself, because writing to HKLM requires administrative privileges… Otherwise code like this would work: var version = Zotero.version;
var arch = Zotero.arch;
if (arch == 'aarch64') {
arch = 'ARM64';
}
else if (arch == 'x86_64') {
arch = 'x64';
}
else if (arch == 'i386') {
arch = 'x86';
}
var versionString = `${version} (${arch})`;
var appDir = FileUtils.getDir('GreBinD', []).path;
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(
Components.interfaces.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
Components.interfaces.nsIWindowsRegKey.ACCESS_READ
);
try {
let i = wrk.childCount - 1;
for (let i = wrk.childCount - 1; i >= 0; i--) {
let name = wrk.getChildName(i);
if (!name.startsWith(Zotero.appName)) continue;
let child = wrk.openChild(
name,
Components.interfaces.nsIWindowsRegKey.ACCESS_READ
| Components.interfaces.nsIWindowsRegKey.ACCESS_WRITE
);
try {
let installLocation = child.readStringValue('InstallLocation');
if (installLocation == appDir) {
child.writeStringValue('DisplayVersion', versionString);
}
}
finally {
child.close();
}
}
}
finally {
wrk.close();
} But it just throws So I think we'd have to patch the updater itself to update the registry key, borrowing code from the Mozilla Maintenance Service. |
Actually, the linked code above is just for the Maintenance Service to update its own entry. For Firefox itself it's handled via the uninstaller's helper.exe with a |
https://forums.zotero.org/discussion/79866/zotero-updater-not-changing-version-number-in-add-or-remove-programs
(Firefox now does this. We should see what they're doing to change a key in the registry.)
The text was updated successfully, but these errors were encountered: