I'm considering creating a non-visual object that contains a "is running as solution" function and a wrapper for the LibraryDirectory function.
The IsRunningAsSolution" function will perform these steps:
- Check the handle of the Application object and return False if it is non-zero. This means the app is NOT running from the IDE, so the LibraryDirectory method will work since the PB objects are packaged into PBD's or DLL's.
- Issue GetLibraryList() to obtain the list of pbl's (for a workspace) or folders (for a solution).
- See if the first (possibly, the only?) "library" file exists. A solution will list the directories as full paths created when the workspace migration to a solution was performed or a new solution is created. These folder names all end with ".pbl". A FileExists call will return True only if the .pbl file exists and False if only the solution folder exists.
Preliminary testing indicates this may be a viable approach.
The LibraryDirectory "wrapper" function will first use the IsRunningAsSolution function. If the PBL's (or deployed .pbd's or .dll's) are available, the PowerScript function is called and the results passed back to the caller. If the PBL's are not available, a search of the files within the "library" directory will be performed against the object type argument as if the PowerScript function was used.