do not print error messages if .scryerrc[.pl] does not exist (#842)

This commit is contained in:
Mark Thom
2021-02-28 17:57:35 -07:00
parent 360485d830
commit a03f00628b
2 changed files with 11 additions and 6 deletions

View File

@@ -5477,11 +5477,9 @@ impl MachineState {
if path.is_dir() { if path.is_dir() {
if let Some(path) = path.to_str() { if let Some(path) = path.to_str() {
let path_atom = self.heap.to_unifiable( let path_string = self.heap.put_complete_string(path);
HeapCellValue::Atom(clause_name!(path.to_string(), self.atom_tbl), None),
);
(self.unify_fn)(self, self[temp_v!(1)], path_atom); self.unify(self[temp_v!(1)], path_string);
return return_from_clause!(self.last_call, self); return return_from_clause!(self.last_call, self);
} }
} }

View File

@@ -2,6 +2,7 @@
copy_term/3]). copy_term/3]).
:- use_module(library(charsio)). :- use_module(library(charsio)).
:- use_module(library(files)).
:- use_module(library(iso_ext)). :- use_module(library(iso_ext)).
:- use_module(library(lists)). :- use_module(library(lists)).
:- use_module(library(si)). :- use_module(library(si)).
@@ -11,8 +12,14 @@
load_scryerrc :- load_scryerrc :-
( '$home_directory'(HomeDir) -> ( '$home_directory'(HomeDir) ->
atom_concat(HomeDir, '/.scryerrc', ScryerrcFile), append(HomeDir, "/.scryerrc", ScryerrcFile),
catch(use_module(ScryerrcFile), E, print_exception(E)) ( file_exists(ScryerrcFile) ->
% convert ScryerrcFile to atom. somehow, I dunno how.
append(ScryerrcFile, "'.", ScryerrcFile0),
read_term_from_chars(['\'' | ScryerrcFile0], ScryerrcFileAtom),
catch(use_module(ScryerrcFileAtom), E, print_exception(E))
; true
)
; true ; true
). ).