From: Eshel Yaron Date: Sat, 3 Dec 2022 18:13:20 +0000 (+0200) Subject: * (sweeprolog--ensure-module): detect and report missing sweep.pl X-Git-Tag: V9.0.1~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=72deef2fbf72ade7f795135020d922fa8e4c8171;p=sweep.git * (sweeprolog--ensure-module): detect and report missing sweep.pl --- diff --git a/sweeprolog.el b/sweeprolog.el index df231b9..514dd3a 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -538,23 +538,26 @@ non-terminals)." (defun sweeprolog--ensure-module () "Locate and load `sweep-module', unless already loaded." (unless (featurep 'sweep-module) - (if-let ((lines (save-match-data - (split-string - (with-output-to-string - (with-current-buffer standard-output - (call-process - (or sweeprolog-swipl-path "swipl") - nil '(t nil) nil - "-q" "-g" "write_sweep_module_location" - "-t" "halt" - (expand-file-name - "sweep.pl" - sweeprolog--directory)))) - "\n" t)))) - (mapc #'sweeprolog--load-module lines) - (error (concat "Failed to locate `sweep-module'. " - "Make sure SWI-Prolog is installed " - "and up to date"))))) + (let ((sweep-pl (expand-file-name + "sweep.pl" + sweeprolog--directory))) + (unless (file-readable-p sweep-pl) + (error "Missing file `sweep.pl' in `sweeprolog' directory")) + (if-let ((lines (save-match-data + (split-string + (with-output-to-string + (with-current-buffer standard-output + (call-process + (or sweeprolog-swipl-path "swipl") + nil '(t nil) nil + "-q" "-g" "write_sweep_module_location" + "-t" "halt" + sweep-pl))) + "\n" t)))) + (mapc #'sweeprolog--load-module lines) + (error (concat "Failed to locate `sweep-module'. " + "Make sure SWI-Prolog is installed " + "and up to date")))))) (defun sweeprolog-ensure-initialized () (sweeprolog--ensure-module)