diff --git a/pl/boot.yap b/pl/boot.yap index 12423bb03..2c94b8a68 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -229,6 +229,7 @@ true :- true. % then recover program. '$startup_reconsult' :- get_value('$consult_on_boot',X), X \= [], !, + writeln(consult:X), set_value('$consult_on_boot',[]), '$do_startup_reconsult'(X). '$startup_reconsult'. @@ -1096,8 +1097,7 @@ bootstrap(F) :- stream_property(Stream, file_name(File)), '$start_consult'(consult, File, LC), file_directory_name(File, Dir), - getcwd(OldD), - cd(Dir), + working_directory(OldD, Dir), ( get_value('$lf_verbose',silent) -> @@ -1107,7 +1107,7 @@ bootstrap(F) :- format(user_error, '~*|% consulting ~w...~n', [LC,F]) ), '$loop'(Stream,consult), - cd(OldD), + working_directory(_, OldD), '$end_consult', ( get_value('$lf_verbose',silent) @@ -1379,10 +1379,6 @@ 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). - diff --git a/pl/consult.yap b/pl/consult.yap index 4e48341bd..52e740a0c 100755 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -243,7 +243,7 @@ use_module(M,F,Is) :- ( OldMode == off -> '$enter_system_mode' ; true ), '$record_loaded'(Stream, ContextModule, Reconsult), '$current_module'(OldModule,ContextModule), - getcwd(OldD), + working_directory(OldD,OldD), nb_getval('$consulting_file',OldF), '$set_consulting_file'(Stream), H0 is heapused, '$cputime'(T0,_), @@ -290,7 +290,7 @@ use_module(M,F,Is) :- '$comp_mode'(CompMode, OldCompMode), nb_setval('$consulting',Old), nb_setval('$consulting_file',OldF), - cd(OldD), + working_directory(_,OldD), % surely, we were in run mode or we would not have included the file! nb_setval('$if_skip_mode',run), % back to include mode! @@ -613,7 +613,7 @@ remove_from_path(New) :- '$check_path'(New,Path), % '$set_consulting_dir'(F) :- file_directory_name(F, Dir), - cd(Dir). + working_directory(_, Dir). '$record_loaded'(Stream, M, Reconsult) :- Stream \= user, diff --git a/pl/utils.yap b/pl/utils.yap index 5ea3410f2..01ed7fb0a 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -218,6 +218,10 @@ current_op(X,Y,Z) :- cd :- cd('~'). +cd(F) :- absolute_file_name(F, Dir, [file_type(directory)]), working_directory(_, Dir). + +getcwd(Dir) :- working_directory(Dir, Dir). + ls :- getcwd(X), '$load_system_ls'(X,L),