]> git.eshelyaron.com Git - dict.git/commitdiff
FIXED: use a more robust mechanism for finding sweep-module
authorEshel Yaron <me@eshelyaron.com>
Mon, 26 Sep 2022 09:16:16 +0000 (12:16 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 26 Sep 2022 09:25:02 +0000 (12:25 +0300)
sweep.el
sweep.pl

index 7ba846beb14d6993d8fa0a510abb02ad4bab8d74..8ba8cabf0c311437d529086ba95d2b66b167b494 100644 (file)
--- a/sweep.el
+++ b/sweep.el
@@ -138,17 +138,16 @@ inserted to the input history in `sweep-top-level-mode' buffers."
 (declare-function sweep-cleanup       "sweep-module")
 
 (defun sweep--ensure-module ()
-  (let ((swipl-lib-dir (car
-                        (split-string-and-unquote
-                         (shell-command-to-string
-                          (concat
-                           (or sweep-swipl-path (executable-find "swipl"))
-                           " --dump-runtime-variables |"
-                           " grep PLLIBDIR |"
-                           " cut -f 2 -d = |"
-                           " cut -f 1 -d ';'"))))))
-    (load (expand-file-name "sweep-module" swipl-lib-dir))))
-
+  (let ((sweep-module-path (car
+                            (string-lines
+                             (shell-command-to-string
+                              (concat
+                               (or sweep-swipl-path (executable-find "swipl"))
+                               " -g"
+                               " write_sweep_module_location"
+                               " -t"
+                               " halt"))))))
+    (load sweep-module-path)))
 
 (defface sweep-debug-prefix-face
   '((default :inherit shadow))
index de9be3e20e80202e9882bc3c13c3808d9979691f..844bd36f184cf54e08c6d19ad3acc5488c7bcc55 100644 (file)
--- a/sweep.pl
+++ b/sweep.pl
@@ -54,7 +54,8 @@
             sweep_prefix_ops/2,
             sweep_op_info/2,
             sweep_imenu_index/2,
-            sweep_module_path/2
+            sweep_module_path/2,
+            write_sweep_module_location/0
           ]).
 
 :- use_module(library(pldoc)).
@@ -738,3 +739,9 @@ sweep_imenu_index(Path, Index) :-
               term_string(PI, String)
             ),
             Index).
+
+write_sweep_module_location :-
+    absolute_file_name(foreign('sweep-module'),
+                       Path,
+                       [file_type(executable), access(read)]),
+    writeln(Path).