[top] [up] [next]

Searching for a module


A Prolog program can be installed in any folder, to still find the correct files to load can be a problem. To solve this problem there is the predicate open_module_search/3, instead of an absolute path a relative path can be specified and a search is started from the location of the executable, which is interpreting the Prolog program, to the root folder.

For example:

    open_module_search(menu, "examples\\menu\\menu.txt", read).

If the Trinc-Prolog executable is installed in "c:\Program Files\Trinc\Trinc-Prolog\" then the following filepaths are used to open the file 'menu.txt':

    c:\Program Files\Trinc\Trinc-Prolog\examples\menu\menu.txt

If the file is not found then the following paths are searched, etc.

    c:\Program Files\Trinc\examples\menu\menu.txt
    c:\Program Files\examples\menu\menu.txt

until the root folder:

    c:\examples\menu\menu.txt

[top] [up] [next]

 

info@trinc-prolog.com