implement access_file/2 in C

This commit is contained in:
Vítor Santos Costa
2010-08-03 21:04:16 +01:00
parent 69b21df917
commit c081d01e78
6 changed files with 85 additions and 23 deletions

View File

@@ -1120,29 +1120,6 @@ bootstrap(F) :-
'$do_error'(type_error(callable,H),P).
'$check_head'(_,_).
% Path predicates
access_file(F,Mode) :-
'$exists'(F,Mode).
'$exists'(_,none) :- !.
'$exists'(F,exist) :- !,
'$access'(F).
'$exists'(F,Mode) :-
get_value(fileerrors,V),
set_value(fileerrors,0),
operating_system_support:true_file_name(F, F1),
(
'$open'(F1, Mode, S, 0, 1, F)
->
'$close'(S),
set_value(fileerrors,V)
;
set_value(fileerrors,V),
fail
).
% term expansion
%
% return two arguments: Expanded0 is the term after "USER" expansion.