use iuse executable to handle cases hwere we may have different versions of YAP around.
This commit is contained in:
parent
eff7a5afcc
commit
f8f2376394
54
pl/absf.yap
Normal file → Executable file
54
pl/absf.yap
Normal file → Executable file
@ -149,7 +149,7 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
'$find_in_path'(commons(D),_,_, _) :-
|
||||
% make sure library_directory is open.
|
||||
\+ clause(user:commons_directory(_),_),
|
||||
'$system_commons_directories'(D),
|
||||
'$system_library_directories'(commons, D),
|
||||
assert(user:commons_directory(D)),
|
||||
fail.
|
||||
'$find_in_path'(S, Opts, NewFile, Call) :-
|
||||
@ -255,16 +255,56 @@ absolute_file_name(File,Opts,TrueFileName) :-
|
||||
recorded('$path',Path,_),
|
||||
atom_concat([Path,File],PFile).
|
||||
|
||||
'$system_library_directories'(Dir) :-
|
||||
'$system_library_directories'(library, Dir) :-
|
||||
getenv('YAPSHAREDIR', Dirs),
|
||||
'$split_by_sep'(0, 0, Dirs, Dir).
|
||||
'$system_library_directories'(Dir) :-
|
||||
'$system_commons_directories'(commons, Dir) :-
|
||||
getenv('YAPCOMMONSDIR', Dirs),
|
||||
'$split_by_sep'(0, 0, Dirs, Dir).
|
||||
'$system_library_directories'(Dir) :-
|
||||
get_value(system_library_directory,Dir).
|
||||
'$system_library_directories'(Dir) :-
|
||||
get_value(prolog_commons_directory,Dir).
|
||||
% windows has stuff installed in the registry
|
||||
'$system_library_directories'(Library, Dir) :-
|
||||
'$swi_current_prolog_flag'(windows, true),
|
||||
once( (
|
||||
'$swi_current_prolog_flag'(address_bits, 64) ->
|
||||
( HKEY='HKEY_LOCAL_MACHINE/Software/YAP/Prolog64';
|
||||
HKEY='HKEY_CURRENT_USER/Software/YAP/Prolog64' )
|
||||
;
|
||||
( HKEY='HKEY_LOCAL_MACHINE/Software/YAP/Prolog';
|
||||
HKEY='HKEY_CURRENT_USER/Software/YAP/Prolog' )
|
||||
),
|
||||
|
||||
% sanity check: are we running the binary mentioned in the registry?
|
||||
'$system_catch'(win_registry_get_value(HKEY,'bin', Bin), prolog,_,fail) ),
|
||||
'$swi_current_prolog_flag'(executable, Bin1),
|
||||
same_file(Bin, Bin1),
|
||||
'$system_catch'(win_registry_get_value(HKEY, Library, Dir), prolog,_,fail).
|
||||
% not installed on registry
|
||||
'$system_library_directories'(Library, Dir) :-
|
||||
'$yap_paths'(_DLLs, ODir1, OBinDir ),
|
||||
'$expand_file_name'( ODir1, Dir1 ),
|
||||
'$expand_file_name'( OBinDir, BinDir ),
|
||||
% '$swi_current_prolog_flag'(executable, Bin1),
|
||||
% prolog_to_os_filename( Bin2, Bin1 ),
|
||||
% file_directory_name( Bin2, BinDir1 ),
|
||||
% same_file( BinDir, BinDir1 ),
|
||||
( Library == library ->
|
||||
atom_concat( Dir1, '/Yap' , Dir )
|
||||
;
|
||||
atom_concat( Dir1, '/PrologCommons' , Dir )
|
||||
),
|
||||
exists_directory( Dir ), !.
|
||||
% desperation: let's check the executable directory
|
||||
'$system_library_directories'(Library, Dir) :-
|
||||
'$swi_current_prolog_flag'(executable, Bin1),
|
||||
prolog_to_os_filename( Bin2, Bin1 ),
|
||||
file_directory_name( Bin2, Dir1 ),
|
||||
( Library == library ->
|
||||
atom_concat( Dir1, '../share/Yap' , Dir )
|
||||
;
|
||||
atom_concat( Dir1, '../share/PrologCommons' , Dir )
|
||||
),
|
||||
exists_directory( Dir ), !.
|
||||
|
||||
|
||||
|
||||
'$split_by_sep'(Start, Next, Dirs, Dir) :-
|
||||
|
18
pl/boot.yap
18
pl/boot.yap
@ -28,6 +28,7 @@ true :- true.
|
||||
'$init_system'.
|
||||
|
||||
'$do_live' :-
|
||||
'$init_win_graphics',
|
||||
repeat,
|
||||
'$current_module'(Module),
|
||||
( Module==user ->
|
||||
@ -108,13 +109,24 @@ true :- true.
|
||||
fail.
|
||||
'$init_consult' :-
|
||||
retractall(user:library_directory(_)),
|
||||
% make sure library_directory is open.
|
||||
\+ clause(user:library_directory(_),_),
|
||||
'$system_library_directories'(D),
|
||||
'$system_library_directories'(library, D),
|
||||
assert(user:library_directory(D)),
|
||||
fail.
|
||||
'$init_consult' :-
|
||||
retractall(user:commons_directory(_)),
|
||||
'$system_library_directories'(commons, D),
|
||||
assert(user:commons_directory(D)),
|
||||
fail.
|
||||
'$init_consult'.
|
||||
|
||||
'$init_win_graphics' :-
|
||||
'$undefined'(window_title(_,_), system), !.
|
||||
'$init_win_graphics' :-
|
||||
load_files([library(win_menu)], [silent(true)]),
|
||||
( win_menu:init_win_menus -> true ; true ),
|
||||
fail.
|
||||
'$init_win_graphics'.
|
||||
|
||||
'$init_or_threads' :-
|
||||
'$c_yapor_workers'(W), !,
|
||||
'$start_orp_threads'(W).
|
||||
|
@ -251,7 +251,7 @@ user:prolog_file_type(A, executable) :-
|
||||
file_search_path(library, Dir) :-
|
||||
library_directory(Dir).
|
||||
file_search_path(commons, Dir) :-
|
||||
commons_directory(Dir0).
|
||||
commons_directory(Dir).
|
||||
file_search_path(swi, Home) :-
|
||||
current_prolog_flag(home, Home).
|
||||
file_search_path(yap, Home) :-
|
||||
|
@ -41,7 +41,12 @@ load_foreign_files(Objs,Libs,Entry) :-
|
||||
'$check_obj_for_load_foreign_files'(V,_,G) :- var(V), !,
|
||||
'$do_error'(instantiation_error,G).
|
||||
'$check_obj_for_load_foreign_files'(Obj,NewObj,_) :- atom(Obj), !,
|
||||
'$process_obj_suffix'(Obj,NewObj).
|
||||
( atom(Obj), Obj1 = foreign(Obj) ; Obj1 = Obj ),
|
||||
absolute_file_name(foreign(Obj),[file_type(executable),
|
||||
access(read),
|
||||
expand(true),
|
||||
file_errors(fail)
|
||||
], NewObj).
|
||||
'$check_obj_for_load_foreign_files'(Obj,_,G) :-
|
||||
'$do_error'(type_error(atom,Obj),G).
|
||||
|
||||
|
Reference in New Issue
Block a user