I'm using spacemacs and currently I'm using the following in my user-config
to switch to the scratch buffer when emacs starts:
(setq inhibit-splash-screen t)
(switch-to-buffer "*scratch*")
However, I want to adapt that code to open an org file instead. The issue is that I run the same config on 3 different computers and the location of the file is different for each:
- ~/Dropbox/myfile.org
- C:\Dropbox\myfile.org
- D:\Dropbox\myfile.org
How do I add some condition checking so that:
- If I'm on OSX or Linux, load the org file from
~/Dropbox/myfile.org
- If I'm on Windows and the file exists, load it from
D:\Dropbox\myfile.org
- If I'm on Windows and #2 doesn't exist, load it from
C:\Dropbox\myfile.org
My issue is differentiating between case 2 and 3. Case 1 can be handled by checking system-type
, but on my desktop I have multiple hard drives so I keep Dropbox on D:\
, but on my laptop I only have 1 SSD so Dropbox is on C:\
, and need a way to figure out the correct path to the file on both Windows systems
file-exists-p
.Dropbox
directory on Windows.system-type
you could usesystem-name
.