Page 1 of 1

Foxit package shell

Published: May 4, 2026 - 4:33 PM
by Balem
Good morning,
We are importing the Foxit package in DEV maturity to install it on a few workstations to ensure that there are no side effects.
When we switch the package to PROD, it deletes the "Foxit Software" folders but does not reinstall the software because the version is identical.
Do you think that the deletion of folders should be included in the 'if' condition to correct this typo?
THANKS

Code: Select all

for to_uninstall in installed_softwares(name="Foxit PDF Reader"):
	if Version(to_uninstall["version"]) < Version(control.get_software_version()) or force:
		print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
		killalltasks(ensure_list(control.impacted_process))
		run(uninstall_cmd(to_uninstall["key"]))
		wait_uninstallkey_absent(to_uninstall["key"])

old_app_dir = makepath(programfiles32, "Foxit Software", "Foxit Reader")
if isdir(old_app_dir):
	remove_tree(old_app_dir)

old_app_dir = makepath(programfiles, "Foxit Software")
if isdir(old_app_dir):
	remove_tree(old_app_dir)

# Installing the package
install_exe_if_needed(
	bin_name,
	silentflags="/quiet",
	timeout=900,
	name="Foxit PDF Reader",
	min_version=control.get_software_version(),
)

Re: Foxit package shell

Published: May 4, 2026 - 4:59 PM
by italbot
Good morning,

From what I can see in the code, the uninstallation in the install() function only runs if the version is lower:
if Version(to_uninstall["version"]) < Version(control.get_software_version()) or force:
If you remove this condition, the uninstallation should proceed, even if it's the same version.
You can also modify it in this way:
if Version(to_uninstall["version"]) <= Version(control.get_software_version()) or force:
Sincerely,

Ingrid

Re: Foxit package shell

Published: May 5, 2026 - 8:52 AM
by Balem
Hello, thank you for this feedback. The idea is to indent the deletion of folders after uninstallation (if it occurs)

Code: Select all

for to_uninstall in installed_softwares(name="Foxit PDF Reader"):
	if Version(to_uninstall["version"]) < Version(control.get_software_version()) or force:
		print(f"Removing: {to_uninstall['name']} ({to_uninstall['version']})")
		killalltasks(ensure_list(control.impacted_process))
		run(uninstall_cmd(to_uninstall["key"]))
		wait_uninstallkey_absent(to_uninstall["key"])

		old_app_dir = makepath(programfiles32, "Foxit Software", "Foxit Reader")
		if isdir(old_app_dir):
			remove_tree(old_app_dir)

		old_app_dir = makepath(programfiles, "Foxit Software")
		if isdir(old_app_dir):
			remove_tree(old_app_dir)

# Installing the package
install_exe_if_needed(
	bin_name,
	silentflags="/quiet",
	timeout=900,
	name="Foxit PDF Reader",
	min_version=control.get_software_version(),
)

Re: Foxit package shell

Published: May 5, 2026 - 09:10
by italbot
Hello,

Yes, you can do that in addition, but you will still need to modify the version comparison condition; otherwise, nothing will be uninstalled before the installation.

Sincerely,

Ingrid