Custom library paths, across installations / platforms

Hello,

I’d like to define a number of custom libraries that can be declared with :-use_module(library(mylib)).

I am using git to clone files and am working across a number of computers and OSs (Win/|Ubuntu).

I’d like to define my own “top” level library directory at my project root, that is then found no matter to where i git / clone the project – other absolute folders on other machines, and across Win / Ubuntu.

It looks like i need to play with file_search_path, and assert something … but, when is this done and what, so it works out of the box when using modules.

any thoughts (and examples) are much appreciated …

thank you,

Dan

2 Likes

The typical scenario is to setup a file search path named after your application based on prolog_load_context(directory, Dir). Next you create search paths for the various components of your application relative to the application main dir. You can of course setup may more search location for library, but in most cases I use some now derived from the component. That makes it easier to see where things come from and avoids ambiguity if there are duplicates in the many library locations.

One example is lib/paths.pl from SWISH.

1 Like