]> Repositorios git - scryer-prolog.git/commitdiff
do not print error messages if .scryerrc[.pl] does not exist (#842)
authorMark Thom <[email protected]>
Mon, 1 Mar 2021 00:57:35 +0000 (17:57 -0700)
committerMark Thom <[email protected]>
Mon, 1 Mar 2021 00:57:35 +0000 (17:57 -0700)
src/machine/system_calls.rs
src/toplevel.pl

index dfe0411fec089cdf26dd486ff1302d805762bd44..1ffa227e4b5814326574f4325f0a19da25874205 100644 (file)
@@ -5477,11 +5477,9 @@ impl MachineState {
 
                 if path.is_dir() {
                     if let Some(path) = path.to_str() {
-                        let path_atom = self.heap.to_unifiable(
-                            HeapCellValue::Atom(clause_name!(path.to_string(), self.atom_tbl), None),
-                        );
+                        let path_string = self.heap.put_complete_string(path);
 
-                        (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);
                     }
                 }
index daf035252f1abf9fde8700701c4895acc1ff2164..e0f1bcc1ac35748ee4abdf0704e52042b05df76b 100644 (file)
@@ -2,6 +2,7 @@
                         copy_term/3]).
 
 :- use_module(library(charsio)).
+:- use_module(library(files)).
 :- use_module(library(iso_ext)).
 :- use_module(library(lists)).
 :- use_module(library(si)).
 
 load_scryerrc :-
     (  '$home_directory'(HomeDir) ->
-       atom_concat(HomeDir, '/.scryerrc', ScryerrcFile),
-       catch(use_module(ScryerrcFile), E, print_exception(E))
+       append(HomeDir, "/.scryerrc", ScryerrcFile),
+       (  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
     ).