| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 9)

Using a Module Search Path to Load KB Files

By default, when loading a KB whose module directly requires other modules, G2 searches in the same directory as the loaded KB for the files containing the other modules.

You can also load KB files that are located in other directories. When structuring your KB directories in this way, you might want to specify a module search path. A module search path is a list of directories that G2 searches to find the KB file containing a directly required module.


Tip: Specifying a module search path can be especially helpful if you load or merge KB files for which there are multiple copies stored in different directories. In this situation, you specify a module search path to direct G2 to load or merge a particular version of the KB file, if it exists in one directory rather than in another directory.

G2 consults the list of directories in the module search path in these situations:

You can direct a new G2 process to use a module search path to locate KB files in either of two ways:

In the argument to the-module-search-path command-line option and in the G2_MODULE_SEARCH_PATH environment variable, to specify more than one directory, enclose the list of directories in double quotes. Include a blank space character between the directory pathnames.


Tip: The -module-search-path command-line option is described under module-search-path.

For example, on a UNIX platform, you can use either of these two command scripts to start a G2 process that searches for KBs in two directories other than the current directory:

When you load a new top-level KB, G2 searches the directories listed in the module search path as follows:

  1. G2 determines whether the Directly-required-modules attribute in that KB's Module Information system table refers to other KBs.

    1. If so, G2 searches for the directly required KB file in the directory that contains the top-level KB file.

    2. If G2 does not find the directly required KB file in the top-level KB file's directory, G2 searches, in order, each directory specified in the module search path.

  2. When G2 finds a KB file of the correct name, G2 determines whether it, in turn, directly requires other KB files, then follows Steps 1a and 1b to locate that KB file.

  3. If G2 cannot find either the top-level KB file or its directly required KB file(s), using Steps 1 through 2, G2 searches the directory that was current when you launched G2. If G2 does not find the KB file in this directory, G2 reports an error.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (8 out of 9)

Copyright © 1997 Gensym Corporation, Inc.