GodOrGovern
GodOrGovern

Reputation: 41

How to Change Package Directory in SWI-Prolog

I am attempting to install a package (sldnfdraw) in SWI-Prolog, but I cannot find a way to specify an installation directory (ie where I want it to be installed).

The documentation seems to indicate one can choose the package directory, but I haven't had luck in doing so. Admittedly, I am fairly new to Prolog and may be overlooking something obvious. Nonetheless, I have searched for answers in all the usual places (Stack Overflow, documentation) with no luck.

I attempted to install the package sldnfdraw by calling pack_install(sldnfdraw). This would have created a directory at $HOME/lib/swipl/pack. I then attempted various incarnations of pack_install(sldnfdraw, $PREF_DIR). where $PREF_DIR is the absolute path of the directory where I wanted the package to be installed. The documentation referenced some way of passing options to functions, but it did not specify a method for doing so. Given the limited resources available on Prolog (and this specific implementation) I find myself at a dead end. Hopefully someone can point me in the right direction.

Upvotes: 1

Views: 242

Answers (1)

GodOrGovern
GodOrGovern

Reputation: 41

The function for specifying the installation directory is package_directory/1. In order to use this in conjunction with pack_install/2, I needed to enclose it in brackets. Therefore the query to install package sldnfdraw into directory $PREF_DIR looks like

pack_install(sldfndraw, [package_directory($PREF_DIR)]).

Upvotes: 2

Related Questions