Redesign doom-system-os
This commit is contained in:
parent
c37e679e44
commit
acca0a86c7
1 changed files with 18 additions and 14 deletions
|
@ -2,20 +2,24 @@
|
||||||
(provide 'core-lib-system)
|
(provide 'core-lib-system)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-system-os ()
|
(defun doom-system-os (&optional os)
|
||||||
"Returns the OS: arch, debian, macos, general linux, cygwin or windows."
|
"Returns the OS: arch, debian, macos, general linux, cygwin or windows. If OS
|
||||||
(let ((gnu-linux-p (eq system-type 'gnu/linux)))
|
is given, returns t if it matches the current system, and nil otherwise."
|
||||||
(cond ((and gnu-linux-p (file-exists-p "/etc/arch-release"))
|
(let* ((gnu-linux-p (eq system-type 'gnu/linux))
|
||||||
'arch)
|
(type (cond ((and gnu-linux-p (file-exists-p "/etc/arch-release"))
|
||||||
((and gnu-linux-p (file-exists-p "/etc/debian_version"))
|
'arch)
|
||||||
'debian)
|
((and gnu-linux-p (file-exists-p "/etc/debian_version"))
|
||||||
(gnu-linux-p
|
'debian)
|
||||||
'linux)
|
(gnu-linux-p
|
||||||
((eq system-type 'darwin)
|
'linux)
|
||||||
'macos)
|
((eq system-type 'darwin)
|
||||||
((memq system-type '(windows-nt cygwin))
|
'macos)
|
||||||
'windows)
|
((memq system-type '(windows-nt cygwin))
|
||||||
(t (error "Unknown OS: %s" system-type)))))
|
'windows)
|
||||||
|
(t (error "Unknown OS: %s" system-type)))))
|
||||||
|
(if os
|
||||||
|
(eq os type)
|
||||||
|
type)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-sh (command &rest args)
|
(defun doom-sh (command &rest args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue