Written by

Developer - Internal Applications at InterSystems
Question Pravin Barton · Feb 14, 2025

How to get IPM module name from source directory

For some build scripting with the InterSystems Package Manager, I'd like to first uninstall a package with `zpm "uninstall"` and then load it from disk using `zpm "load"`. That way anything that got deleted from the source will also be deleted from IRIS. 

The problem is that `zpm "uninstall"` takes in a module name and I only have the directory path to the package source. Is there a way to get the module name for an installed IPM module given the source path? It's okay  to assume that it has previously been installed from that same directory with `zpm "load"`.

Comments

Shuheng Liu · Feb 14, 2025
Set q = "select Name from %IPM_Storage.ModuleItem where Root = ?"
Set rs = ##class(%SQL.Statement).%ExecDirect(, q, folder)
If rs.%Next() { Write rs.%Get("Name") }

I'd recommend looking up the module info using SQL prior to deleting it. 

0