add more lib paths
This commit is contained in:
parent
1e57a2e978
commit
9895ec63d0
44
C/sysbits.c
44
C/sysbits.c
@ -245,6 +245,27 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
|
||||
CACHE_REGS
|
||||
int len;
|
||||
|
||||
#if __WINDOWS__
|
||||
{
|
||||
char *dir;
|
||||
if ((dir = Yap_RegistryGetString("library")) &&
|
||||
is_directory(dir)) {
|
||||
if (! Yap_unify( tlib,
|
||||
MkAtomTerm(Yap_LookupAtom(dir))) )
|
||||
return FALSE;
|
||||
}
|
||||
dir_done = true;
|
||||
if ((dir = Yap_RegistryGetString("prolog_commons")) &&
|
||||
is_directory(dir)) {
|
||||
if (! Yap_unify( tcommons,
|
||||
MkAtomTerm(Yap_LookupAtom(dir))) )
|
||||
return FALSE;
|
||||
}
|
||||
commons_done = true;
|
||||
}
|
||||
if (dir_done && commons_done)
|
||||
return TRUE;
|
||||
#endif
|
||||
strncpy(LOCAL_FileNameBuf, YAP_SHAREDIR, YAP_FILENAME_MAX);
|
||||
strncat(LOCAL_FileNameBuf,"/", YAP_FILENAME_MAX);
|
||||
len = strlen(LOCAL_FileNameBuf);
|
||||
@ -273,25 +294,6 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
|
||||
return TRUE;
|
||||
|
||||
#if __WINDOWS__
|
||||
{
|
||||
char *dir;
|
||||
if ((dir = Yap_RegistryGetString("library")) &&
|
||||
is_directory(dir)) {
|
||||
if (! Yap_unify( tlib,
|
||||
MkAtomTerm(Yap_LookupAtom(dir))) )
|
||||
return FALSE;
|
||||
}
|
||||
dir_done = true;
|
||||
if ((dir = Yap_RegistryGetString("prolog_commons")) &&
|
||||
is_directory(dir)) {
|
||||
if (! Yap_unify( tcommons,
|
||||
MkAtomTerm(Yap_LookupAtom(dir))) )
|
||||
return FALSE;
|
||||
}
|
||||
commons_done = true;
|
||||
}
|
||||
if (dir_done && commons_done)
|
||||
return TRUE;
|
||||
{
|
||||
size_t buflen;
|
||||
char *pt;
|
||||
@ -2528,7 +2530,7 @@ p_virtual_alarm( USES_REGS1 )
|
||||
Yap_Error(INSTANTIATION_ERROR, t, "alarm/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (!IsIntegerTerm(t)) {
|
||||
if (!IsIntegerTerm(t)) {
|
||||
Yap_Error(TYPE_ERROR_INTEGER, t, "alarm/2");
|
||||
return(FALSE);
|
||||
}
|
||||
@ -3096,7 +3098,7 @@ Yap_InitSysPreds(void)
|
||||
Yap_InitCPred ("$yap_home", 1, p_yap_home, SafePredFlag);
|
||||
Yap_InitCPred ("$yap_paths", 3, p_yap_paths, SafePredFlag);
|
||||
Yap_InitCPred ("$dir_separator", 1, p_dir_sp, SafePredFlag);
|
||||
Yap_InitCPred ("libraries_directory", 2, p_libraries_path, 0);
|
||||
Yap_InitCPred ("libraries_directories",2, p_libraries_path, 0);
|
||||
Yap_InitCPred ("system_library", 1, p_library_dir, 0);
|
||||
Yap_InitCPred ("commons_library", 1, p_commons_dir, 0);
|
||||
Yap_InitCPred ("$alarm", 4, p_alarm, SafePredFlag|SyncPredFlag);
|
||||
|
31
pl/absf.yap
31
pl/absf.yap
@ -1,6 +1,6 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
@ -112,10 +112,10 @@ swapped, making the call
|
||||
valid as well.
|
||||
*/
|
||||
|
||||
absolute_file_name(File,TrueFileName,Opts) :-
|
||||
absolute_file_name(File,TrueFileName,Opts) :-
|
||||
( var(TrueFileName) ->
|
||||
true ;
|
||||
atom(TrueFileName), TrueFileName \= []
|
||||
atom(TrueFileName), TrueFileName \= []
|
||||
), !,
|
||||
absolute_file_name(File,Opts,TrueFileName).
|
||||
absolute_file_name(File,Opts,TrueFileName) :-
|
||||
@ -352,7 +352,7 @@ absolute_file_name(File0,File) :-
|
||||
atom_concat([Path,File],PFile).
|
||||
|
||||
'$system_library_directories'(library, Dir) :-
|
||||
library_directory( Dir ).
|
||||
user:library_directory( Dir ).
|
||||
% '$split_by_sep'(0, 0, Dirs, Dir).
|
||||
'$system_library_directories'(foreign, Dir) :-
|
||||
foreign_directory( Dir ).
|
||||
@ -362,6 +362,7 @@ absolute_file_name(File0,File) :-
|
||||
commons_directory( Dir ).
|
||||
|
||||
|
||||
|
||||
'$split_by_sep'(Start, Next, Dirs, Dir) :-
|
||||
'$swi_current_prolog_flag'(windows, true),
|
||||
'$split_by_sep'(Start, Next, Dirs, ';', Dir), !.
|
||||
@ -499,15 +500,30 @@ remove_from_path(New) :- '$check_path'(New,Path),
|
||||
reconsult/1, use_module/1, ensure_loaded/1, and load_files/2.
|
||||
|
||||
This directory is initialized s a rule that calls the system predicate
|
||||
library_directories/2.
|
||||
system_library/1.
|
||||
*/
|
||||
|
||||
:- multifile user:library_directory/1.
|
||||
|
||||
:- dynamic user:library_directory/1.
|
||||
|
||||
user:library_directory( Path ):-
|
||||
system_library( Path ).
|
||||
%% user:library_directory( ?Dir )
|
||||
% Specifies the set of directories where
|
||||
% one can find Prolog libraries.
|
||||
%
|
||||
% 1. honor YAPSHAREDIR
|
||||
user:library_directory( Dir ) :-
|
||||
getenv( 'YAPSHAREDIR', Dir0),
|
||||
absolute_file_name( Dir0, [file_type(directory), expand(true)], Dir ).
|
||||
%% 2. honor user-library
|
||||
user:library_directory( Dir ) :-
|
||||
absolute_file_name( '~/share/Yap', [file_type(directory), expand(true)], Dir ).
|
||||
%% 3. honor current directory
|
||||
user:library_directory( Dir ) :-
|
||||
absolute_file_name( '.', [file_type(directory), expand(true)], Dir ).
|
||||
%% 4. honor default location.
|
||||
user:library_directory( Dir ) :-
|
||||
system_library( Dir ).
|
||||
|
||||
/**
|
||||
@pred user:commons_directory(? _Directory_:atom) is nondet, dynamic
|
||||
@ -645,4 +661,3 @@ user:file_search_path(path, C) :-
|
||||
),
|
||||
lists:member(C, B)
|
||||
).
|
||||
|
||||
|
Reference in New Issue
Block a user