-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.py
More file actions
56 lines (50 loc) · 1.54 KB
/
Copy pathlink.py
File metadata and controls
56 lines (50 loc) · 1.54 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# make sure to run this script with python3 from an elevated shell!!
import os
from pathlib import Path
path_home = Path.home()
path_config = Path(path_home, "local_data/utils/dotfiles")
path_list = [
{
"src": Path(path_config, "starship/starship.toml"),
"dst": Path(path_home, ".config/starship.toml")
},
{
"src": Path(path_config, "kickstart.nvim"),
"dst": Path(path_home, ".config/nvim")
},
{
"src": Path(path_config, "wezterm/.wezterm.lua"),
"dst": Path(path_home, ".wezterm.lua")
},
{
"src": Path(path_config, "wezterm"),
"dst": Path(path_home, ".config/wezterm")
},
{
"src": Path(path_config, "glaze-wm"),
"dst": Path(path_home, ".glzr")
},
{
"src": Path(path_config, "linter"),
"dst": Path(path_home, "linter")
},
{
"src": Path(path_config, "powershell/Microsoft.PowerShell_profile.ps1"),
"dst": Path(path_home, "Documents/PowerShell/Microsoft.PowerShell_profile.ps1")
}
]
for item in path_list:
src = item["src"]
dst = item["dst"]
# check file exists
if not src.exists():
print(f"Source file {src} does not exist.")
continue
if dst.exists():
print(f"Destination {dst} already exists.")
continue
try:
os.symlink(src, dst)
print(f"Established symlink from {src} to {dst}")
except OSError as e:
print(f"Failed to create symlink from {src} to {dst}: {e}")