Skip to content

Commit

Permalink
Use Prolog flag path_sep.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Jan 12, 2024
1 parent eaa3e28 commit 7138fe4
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions jpl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3826,7 +3826,7 @@

classpath(DirOrJar) :-
getenv('CLASSPATH', ClassPath),
search_path_separator(Sep),
current_prolog_flag(path_sep, Sep),
atomic_list_concat(Elems, Sep, ClassPath),
member(DirOrJar, Elems).

Expand All @@ -3839,7 +3839,7 @@

add_search_path(Path, Dir) :-
( getenv(Path, Old)
-> search_path_separator(Sep),
-> current_prolog_flag(path_sep, Sep),
( atomic_list_concat(Current, Sep, Old),
memberchk(Dir, Current)
-> true % already present
Expand All @@ -3854,16 +3854,6 @@
; setenv(Path, Dir)
).

%! search_path_separator(-Sep:atom)
%
% Separator used the the OS in =PATH=, =LD_LIBRARY_PATH=,
% =CLASSPATH=, etc.

search_path_separator((;)) :-
current_prolog_flag(windows, true),
!.
search_path_separator(:).

env_var_separators('%','%') :-
current_prolog_flag(windows, true),
!.
Expand Down Expand Up @@ -3944,7 +3934,7 @@

library_search_path(Path, EnvVar) :-
current_prolog_flag(shared_object_search_path, EnvVar),
search_path_separator(Sep),
current_prolog_flag(path_sep, Sep),
( getenv(EnvVar, Env),
atomic_list_concat(Path, Sep, Env)
-> true
Expand Down Expand Up @@ -3981,7 +3971,7 @@
]),
!,
( getenv('CLASSPATH', Old)
-> search_path_separator(Separator),
-> current_prolog_flag(path_sep, Separator),
atomic_list_concat([JplJAR, Old], Separator, New)
; New = JplJAR
),
Expand Down Expand Up @@ -4077,7 +4067,7 @@
jpl_get_default_jvm_opts(Opts0),
( select(PathOpt0, Opts0, Rest),
sub_atom(PathOpt0, 0, _, _, '-Djava.library.path=')
-> search_path_separator(Separator),
-> current_prolog_flag(path_sep, Separator),
atomic_list_concat([PathOpt0, Separator, OsDir], PathOpt),
NewOpts = [PathOpt|Rest]
; atom_concat('-Djava.library.path=', OsDir, PathOpt),
Expand Down

0 comments on commit 7138fe4

Please sign in to comment.