I spent a lot of time trying to make file_search_path include a path to my library, but I was unsuccessful. In my project, there is a subdirectory called “lib” where I place my code, but I cannot make the use_module method search there. I am using
file_search_path(library, './lib')
and expecting that
:- use_module(library(bitrix24_auth))
will find my library there, but I receive the message “source_sink `library(bitrix24_auth)’ does not exist.” Where am I making a mistake?
file_search_path/2
must be in the module user
. Surely just lib
will work too, but so should ./lib
. You can use this to see what locations it tries.
?- set_prolog_flag(verbose_file_search, true).
source_sink
library(bitrix24_auth)’ does not exist`
All I get
looking for anywhere, but not in the catalog of my program
Maybe this will help.
My question is that I have not achieved success. I managed to force the code to work at the beginning of my module
:- assertz(user:file_search_path (library,'/lib ')).
Prior to call
:- use_module (bitrix24_AUTH)).
Perhaps you should reverse the problem. Instead of trying to create the code first and hoping it works as expected, create a set of queries to see what is happening and then adjust the queries as needed until the desired goal is reached and use that to create the needed code, e.g.
?- absolute_file_name(.,Path).
Path = 'c:/users/groot/documents/prolog'.
?- absolute_file_name(lib,Path).
Path = 'c:/users/groot/documents/prolog/lib'.
?- user:file_search_path(Name,Path).
Name = swi,
Path = 'c:/program files/swipl' ;
Name = library,
Path = app_config(lib) ;
Name = library,
Path = swi(library) ;
Name = library,
Path = swi(library/clp)
...
These are just an example of queries to try, in writing the Wiki article many such queries were created before it made sense.