Subject: [PATCH v3 8/8] gnu: scilab: Set default SCIHOME value.

From: Nicolas Graves <[email-masked]>
Date: Mon, 6 Nov 2023 00:51:51 +0100

* gnu/packages/maths.scm (scilab): Set default SCIHOME value.
[argmuments](phases)[rewrap-scilab-cli]: Set default -scihome option
to respect XDG base dirs specification.

Change-Id: I9b55758a3ca1fbc523c3e40e891a2462f3246390
---
 gnu/packages/maths.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index dae4c528e2..355f2132bd 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -9734,8 +9734,12 @@ (define (bin path) (string-append #$output "/bin/" path))
                 (copy-file (bin ".scilab-cli-bin-real") (bin "scilab-cli-bin"))
                 (delete-file (bin ".scilab-cli-bin-real"))
                 (substitute* (bin "scilab-cli")
-                  (("\\.scilab-cli-bin-real")
-                   "scilab-cli-bin")
+                  ;; Also set SCIHOME to sensible XDG base dirs value.
+                  (("\\.scilab-cli-bin-real\"")
+                   (string-append
+                    "scilab-cli-bin\" -scihome "
+                    "\"${XDG_STATE_HOME:-$HOME/.local/state}/scilab/"
+                    #$(package-version this-package) "\""))
                   (("export SCI=")
                    "unset LANGUAGE\nexport SCI="))))))))
     (home-page "https://www.scilab.org/")
-- 
2.41.0