From: Mark Thom Date: Sun, 7 Feb 2021 20:47:06 +0000 (-0700) Subject: use parent() instead of ancestors().next() in load_context_directory() X-Git-Tag: v0.9.0~150^2~65^2~5 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=df82dbe5f5f82c446c7892695d1a2d86d7974dee;p=scryer-prolog.git use parent() instead of ancestors().next() in load_context_directory() --- diff --git a/src/machine/loader.rs b/src/machine/loader.rs index 91d41c7f..e713916f 100644 --- a/src/machine/loader.rs +++ b/src/machine/loader.rs @@ -1270,8 +1270,11 @@ impl Machine { pub(crate) fn load_context_directory(&mut self) { if let Some(load_context) = self.load_contexts.last() { - if let Some(directory) = load_context.path.ancestors().next() { + if let Some(directory) = load_context.path.parent() { + // canonicalize returns the absolute path of the directory. + let directory = directory.canonicalize().unwrap(); let directory_str = directory.to_str().unwrap(); + let directory_atom = clause_name!(directory_str.to_string(), self.machine_st.atom_tbl);