From a090d0a7c9168ca6292c6cdf1b8c27c5a067c085 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 7 Jul 2022 21:56:17 -0400 Subject: Automatically add Haunt's modules to Guile's load path at startup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a longstanding usability issue where people would install Haunt to /usr/local and then wonder why Haunt doesn't work, which was because Guile's default load path is /usr and thus could not find the newly installed modules in /usr/local. I received several emails about this over the years and didn't know to deal with it. Many thanks to Daniel Meißner for pointing out that Guix had already found a solution to this problem because of course Guix would have this problem solved! Ludovic is an autotools wizard. --- scripts/haunt.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/haunt.in b/scripts/haunt.in index 7206036..dd25efb 100755 --- a/scripts/haunt.in +++ b/scripts/haunt.in @@ -19,6 +19,15 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Haunt. If not, see . +(define-syntax-rule (push! elt v) (set! v (cons elt v))) + +;; Automatically add Haunt modules to Guile's load path so that users +;; aren't wondering why Haunt isn't working when the modules aren't +;; installed to Guile's default module locations. +(unless (getenv "HAUNT_UNINSTALLED") + (push! "@guilemoduledir@" %load-path) + (push! "@guileobjectdir@" %load-compiled-path)) + (use-modules (haunt ui)) (apply haunt-main (command-line)) -- cgit v1.2.3