Installing an Application: runtime(File)

A runtime system is a single, executable program that can easily be transferred to a different machine. However, in many cases, application programs require access to some auxiliary files in the course of their execution. These may be files of Prolog code that are to be consulted at run time, or they may be data files in any arbitrary format. If your application requires some such files, you may need to require users of the application to follow some installation procedure before they can use it.

One approach to this problem is to use the runtime file search path for accessing all your auxiliary files. The default runtime file search path is the runtime directory where Prolog executables and objects are located. You can modify this by putting a goal such as the following in your prolog.ini file.

     :- retractall(file_search_path(runtime,_)),

This allows you to use runtime(File) anywhere you need to specify a file, such as in calls to open/3, see/1, consult/1 or absolute_file_name/2. When you do this, the file will be sought in the directory /usr/fred/runtime_files.

When you have built a runtime system, you can change the runtime directory and thus the runtime file_search_path by means of the qsetpath utility program (see too-too-qsetpath). This can be changed, perhaps from an installation shell script to be run by the end user. The appropriate command is:

     % qsetpath -rdirectory runtime-system

The program runtime-system will then look in directory for its runtime files. Note that write permission will be needed on runtime-system for the qsetpath command to work.

There is another utility, qgetpath (see too-too-qgetpath), which can be used to print the runtime directory of a runtime system. For example,

     % qgetpath -r runtime-system

writes the runtime directory to standard output. See the qsetpath and qgetpath Reference Pages for more information.