It is easy to get a list of components and plugins "loaded" by 4D, just use the commands COMPONENT LIST and PLUGIN LIST. However, it is not so straight foward when it comes to getting a complete list of components in the "Components" folder or plugins in the "Plugins" folder.
The 4D command COMPONENT LIST returns a list of components 4D "installed" at start up. The 4D command PLUGIN LIST returns a list of plugins 4D "installed" at start up. However, these lists may not be a complete list of the components and plugins that are contained in the Components and Plugins folders.
The code snippets below can be used to get a complete list of components and plugins that are contained in their respective folders, regardless of whether 4D installed them at start up or not.
The 4D command FOLDER LIST is used instead of DOCUMENT LIST because 4D sees these item as folders, though the macOS Finder presents and treats them as documents.
C_OBJECT($Docs_O;$0) ARRAY TEXT($Docs_aT;0) $Path_T:=Get 4D folder(Database folder)+"Components"+Folder separator If (Test path name($Path_T)=Is a folder) FOLDER LIST($Path_T;$Docs_aT) End if OB SET ARRAY($Docs_O;"Components";$Docs_aT) CLEAR VARIABLE($Docs_aT) $Path_T:=Get 4D folder(Database folder)+"PlugIns"+Folder separator If (Test path name($Path_T)=Is a folder) FOLDER LIST($Path_T;$Docs_aT) End if OB SET ARRAY($Docs_O;"Plugins";$Docs_aT) $0:=$Docs_O |
NOTE: If a macOS Alias or Windows Shortcut is used to install a component or plugin it may show up in the lists from COMPONENT LIST and PLUGIN LIST but will not be in the lists from the code above. That is because macOS Aliases and Window Shortcuts are files, not folders.