fix usage of cd/1.

This commit is contained in:
Vitor Santos Costa 2011-05-12 22:26:10 +01:00
parent bce888bd6d
commit c1f74b7682
3 changed files with 10 additions and 10 deletions

View File

@ -229,6 +229,7 @@ true :- true.
% then recover program. % then recover program.
'$startup_reconsult' :- '$startup_reconsult' :-
get_value('$consult_on_boot',X), X \= [], !, get_value('$consult_on_boot',X), X \= [], !,
writeln(consult:X),
set_value('$consult_on_boot',[]), set_value('$consult_on_boot',[]),
'$do_startup_reconsult'(X). '$do_startup_reconsult'(X).
'$startup_reconsult'. '$startup_reconsult'.
@ -1096,8 +1097,7 @@ bootstrap(F) :-
stream_property(Stream, file_name(File)), stream_property(Stream, file_name(File)),
'$start_consult'(consult, File, LC), '$start_consult'(consult, File, LC),
file_directory_name(File, Dir), file_directory_name(File, Dir),
getcwd(OldD), working_directory(OldD, Dir),
cd(Dir),
( (
get_value('$lf_verbose',silent) get_value('$lf_verbose',silent)
-> ->
@ -1107,7 +1107,7 @@ bootstrap(F) :-
format(user_error, '~*|% consulting ~w...~n', [LC,F]) format(user_error, '~*|% consulting ~w...~n', [LC,F])
), ),
'$loop'(Stream,consult), '$loop'(Stream,consult),
cd(OldD), working_directory(_, OldD),
'$end_consult', '$end_consult',
( (
get_value('$lf_verbose',silent) get_value('$lf_verbose',silent)
@ -1379,10 +1379,6 @@ b_getval(GlobalVariable, Val) :-
'$do_error'(existence_error(variable, GlobalVariable),b_getval(GlobalVariable, Val)) '$do_error'(existence_error(variable, GlobalVariable),b_getval(GlobalVariable, Val))
). ).
cd(Dir) :- working_directory(_, Dir).
getcwd(Dir) :- working_directory(Dir, Dir).

View File

@ -243,7 +243,7 @@ use_module(M,F,Is) :-
( OldMode == off -> '$enter_system_mode' ; true ), ( OldMode == off -> '$enter_system_mode' ; true ),
'$record_loaded'(Stream, ContextModule, Reconsult), '$record_loaded'(Stream, ContextModule, Reconsult),
'$current_module'(OldModule,ContextModule), '$current_module'(OldModule,ContextModule),
getcwd(OldD), working_directory(OldD,OldD),
nb_getval('$consulting_file',OldF), nb_getval('$consulting_file',OldF),
'$set_consulting_file'(Stream), '$set_consulting_file'(Stream),
H0 is heapused, '$cputime'(T0,_), H0 is heapused, '$cputime'(T0,_),
@ -290,7 +290,7 @@ use_module(M,F,Is) :-
'$comp_mode'(CompMode, OldCompMode), '$comp_mode'(CompMode, OldCompMode),
nb_setval('$consulting',Old), nb_setval('$consulting',Old),
nb_setval('$consulting_file',OldF), nb_setval('$consulting_file',OldF),
cd(OldD), working_directory(_,OldD),
% surely, we were in run mode or we would not have included the file! % surely, we were in run mode or we would not have included the file!
nb_setval('$if_skip_mode',run), nb_setval('$if_skip_mode',run),
% back to include mode! % back to include mode!
@ -613,7 +613,7 @@ remove_from_path(New) :- '$check_path'(New,Path),
% %
'$set_consulting_dir'(F) :- '$set_consulting_dir'(F) :-
file_directory_name(F, Dir), file_directory_name(F, Dir),
cd(Dir). working_directory(_, Dir).
'$record_loaded'(Stream, M, Reconsult) :- '$record_loaded'(Stream, M, Reconsult) :-
Stream \= user, Stream \= user,

View File

@ -218,6 +218,10 @@ current_op(X,Y,Z) :-
cd :- cd :-
cd('~'). cd('~').
cd(F) :- absolute_file_name(F, Dir, [file_type(directory)]), working_directory(_, Dir).
getcwd(Dir) :- working_directory(Dir, Dir).
ls :- ls :-
getcwd(X), getcwd(X),
'$load_system_ls'(X,L), '$load_system_ls'(X,L),