Here is updated version:
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ffce3d1f..7459b3ef 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -107,7 +107,7 @@ from scratch.
;;; of the {\bf FRICAS} shell variable at build time) if we can't.
;;; Use the parent directory of FRICASsys binary as fallback.
(defun initroot (&optional (newroot nil))
- (reroot (or (|getEnv| "FRICAS") newroot
+ (setq spadroot (or (|getEnv| "FRICAS") newroot
(if (|fricas_probe_file| $spadroot) $spadroot)
(let ((bin-parent-dir
(concatenate 'string
@@ -116,7 +116,10 @@ from scratch.
(if (|fricas_probe_file| (concatenate 'string
bin-parent-dir
"algebra/interp.daase"))
bin-parent-dir))
- (error "setenv FRICAS or (setq $spadroot)"))))
+ (error "setenv FRICAS or (setq $spadroot)")))
+ (if (|fricas_probe_file| spadroot)
+ (reroot (trim-directory-name (namestring (truename spadroot))))
+ (error "Environment variable FRICAS is invalid.")))
;;; Gnu Common Lisp (GCL) (at least 2.6.[78]) requires some changes
;;; to the default memory setup to run FriCAS efficiently.
On 9/27/23 18:16, Waldek Hebisch wrote:
On Wed, Sep 27, 2023 at 08:17:04AM +0800, Qian Yun wrote:
Canonicalize (use absolute path and avoid double slashing) $FRICAS or
parent dir of FRICASsys before setting it to $spadroot.
- Qian
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ffce3d1f..6acd1172 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -107,7 +107,8 @@ from scratch.
;;; of the {\bf FRICAS} shell variable at build time) if we can't.
;;; Use the parent directory of FRICASsys binary as fallback.
(defun initroot (&optional (newroot nil))
- (reroot (or (|getEnv| "FRICAS") newroot
+ (reroot (namestring (truename
+ (or (|getEnv| "FRICAS") newroot
(if (|fricas_probe_file| $spadroot) $spadroot)
(let ((bin-parent-dir
(concatenate 'string
AFAICS this still produces name with slash at the end, which will
lead to double slashes downstream (FriCAS convention is that
directory name contains no shlash at the end). We have a trivial
utility function 'trim-directory-name' to make sure there is no
trailing slash.
Also, 'truename' may throw errors on non-existing directories, I
am not sure how we want to handle that (our directory should
exist, but it needs some testing to check if error message is
reasonable).
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/3b7142ec-7fb7-4f04-98da-6cd86c3515e8%40gmail.com.