I'm using spacemacs and I want to declare different paths for org-mode according to the platform that I'm inside it.
For example, if I'm in Linux, I want the path be ~/orgs
but if I was in windows the path should be D:\orgs\
.
Is there a variable to check the current platform?
One of the solutions(Thanks to @dalanicolai and @milochadam in the gitter website of spacemacs for all of the helps) is that You declare your condition inside user-init ()
for example, I declared two global variables: snippet_path
and org_path
and they will get different values depends on the platform(Linux/windows):
(defun dotspacemacs/user-init ()
;; ... other stuff
(if (or (equal system-type 'cygwin) (equal system-type 'windows-nt) (equal system-type 'ms-dos))
;; if we are in windows
(progn
(setq snippet_path "e:/home/snippets")
(setq org_path "d:/org-mode/todo.org")
)
;; else if (we are in linux)
(progn
(setq snippet_path "/home/ghost/spacemacs/snippets")
(setq org_path "d:/org-mode/todo.org")
)
)
;; ... other stuff
)
Now we can use these two variables everywhere we like, for example inside our layer configs:
(auto-completion :variables
auto-completion-private-snippets-directory snippet_path
)