-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows_setup.py
More file actions
39 lines (30 loc) · 1.09 KB
/
Copy pathwindows_setup.py
File metadata and controls
39 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import platform
import shutil
import sys
from pathlib import Path
appdata_local = Path(os.getenv("LOCALAPPDATA")).resolve()
appdata_roaming = Path(os.getenv("APPDATA")).resolve()
userprofile = Path(os.getenv("USERPROFILE")).resolve()
if not platform.system() == "Windows":
print("Not a Windows system")
sys.exit(0)
sources = {
"nvim": Path() / "nvim" / ".config" / "nvim",
"wezterm": Path() / "wezterm" / ".config" / "wezterm",
"ohmyposh": Path() / "oh-my-posh" / ".config" / "oh-my-posh",
"alacritty": Path() / "alacritty" / ".config" / "alacritty",
}
dests = {
"nvim": userprofile / ".config" / "nvim",
"wezterm": userprofile/ ".config" / "wezterm",
"ohmyposh": userprofile / ".config" / "ohmyposh",
"alacritty": appdata_roaming / "alacritty",
}
source_to_dest = {s: d for s, d in zip(sources.values(), dests.values())}
for source, dest in source_to_dest.items():
if dest.exists() and dest.is_dir() and not dest.is_symlink():
shutil.rmtree(dest)
if dest.is_symlink():
dest.unlink(missing_ok=True)
dest.symlink_to(source.resolve())