================================================================ HowTo: Determine Available Files for the Current Compass Project ================================================================ .. include:: ..\version.h .. include:: howto-reference.h .. contents:: Table of Contents :backlinks: top ------- Problem ------- I need to get a list of available files defined by the Project Control File (PCF) within the current Compass Project. I would also like to get a list of all files, regardless of their availability. -------- Solution -------- The first part, getting the list of currently *available* files by type within the Compass project works as follows, .. Python:: from grail.compass import cmpsys file15s = cmpsys.getfilelistbytype(15) and :d:`file15s` will be a complete listing of available files. That is all files that are available on the disk. The second part, determining all defined files, regardless of availablity, can be done by querying the :c:`Pcf` directly. You can do this with the following snippet, .. Python:: from grail.compass import cmpsys p = cmpsys.getpcf() file15s = p.filelistbytype(15) now :d:`file15s` will be a list containing all files defined in the PCF, regardless of their availablity on the disk. --------- Dicussion --------- If you want to get the current listing of file use the grail.compass.cmpsys_ :f:`getfilelistbytype`. If you want to get all defined files, regardless of their availablity, use the grail.data.pcf_ :c:`Pcf` class to query the Project Control File directly. Keep in mind that the grail.compass.cmpsys_ routines are only availabe from within the context of **Compass Style Script**.