From f8317b1d5dd9cd684b6e9ae3dcec806afc4f787f Mon Sep 17 00:00:00 2001 From: roife Date: Tue, 27 Feb 2024 13:27:38 +0800 Subject: [PATCH] add: detection of arch --- emt.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/emt.el b/emt.el index 07ebfaf..d2a13d7 100644 --- a/emt.el +++ b/emt.el @@ -58,7 +58,7 @@ ;;; Export function -(defconst emt-version "v2.0.0") +(defconst emt-version "v2.1.0") (defvar emt--root (file-name-directory (or load-file-name buffer-file-name)) "The path to the root of the package.") @@ -220,6 +220,14 @@ position of a word)" result)) (error "Dynamic module not loaded"))) +(defun emt-get-arch () + (cond + ((string-match-p "aarch64" system-configuration) + "aarch64") + ((string-match-p "x86_64" system-configuration) + "x86_64")) + ) + ;;;###autoload (defun emt-word-at-point-or-forward () "Return the word at point. @@ -243,10 +251,11 @@ If current point is at bound of a word, return the one backward." If PATH is non-nil, download the module to PATH." (interactive) (unless (eq system-type 'darwin) - (error "Only support macOS")) + (error "EMT only support macOS")) (setq path (or path emt-lib-path)) (make-directory (file-name-directory path) t) - (let ((url (format "https://github.com/roife/emt/releases/download/%s/libEMT.dylib" emt-version))) + (let* ((arch (emt-get-arch)) + (url (format "https://github.com/roife/emt/releases/download/%s/libEMT-%s.dylib" emt-version arch))) (url-copy-file url path t))) ;;;###autoload