Skip to content

Commit

Permalink
add: detection of arch
Browse files Browse the repository at this point in the history
  • Loading branch information
roife committed Feb 27, 2024
1 parent e45a32d commit f8317b1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions emt.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit f8317b1

Please sign in to comment.