Hi Jan,
> > I encountered some unexpected behaviour with compiled SWI code. I use XPCE
> > 6.4.3 with SWI-Prolog version 5.4.7 on WinXP SP2.
> > It seems that in compiled SWI code, as soon as the working directory is
> > changed, the value of W in
> >
> > current_prolog_flag(executable, W)
> >
> > is set to the current working directory. This does not happen when doing
> > this from the command line.
> > Is this supposed to happen? There may be something else going on, the code
> > I'm working on is quite complex, and I haven't done thorough testing yet.
>
> Sounds highly dubious. Of course it wasn't designed to work like this. I
> definitely do need code to reproduce this. Smaller is better, but not
While playing around with path-related predicates in order to reproduce
this in a small example I came across this:
According to the manual (consulting.html#expand_file_search_path/2), the
initial definition of the file search path looks like this:
user:file_search_path(library, X) :-
library_directory(X).
user:file_search_path(swi, Home) :-
current_prolog_flag(home, Home).
user:file_search_path(foreign, swi(ArchLib)) :-
current_prolog_flag(arch, Arch),
atom_concat('lib/', Arch, ArchLib).
user:file_search_path(foreign, swi(lib)).
However:
1 ?- file_search_path(foreign, F).
F = swi('lib/i386-win32') ;
F = swi(lib) ;
F = pce('lib/i386-win32') ;
F = pce(lib) ;
No
So I listed the predicate:
5 ?- listing(file_search_path).
:- dynamic file_search_path/2.
:- multifile file_search_path/2.
[blahblah]
file_search_path(foreign, swi(A)) :-
system:
( current_prolog_flag(arch, B),
atom_concat('lib/', B, A)
).
file_search_path(foreign, swi(lib)).
[blahblah]
file_search_path(foreign, pce(A)) :-
link_xpce:
( current_prolog_flag(arch, B),
atom_concat('lib/', B, A)
).
file_search_path(foreign, pce(lib)).
So the manual is misleading on this point, the initial definition of
file_search_path/2 is more extensive.
Regards,
Christophe Costa Florencio
|