chezmoi: windows symlink for config

This commit is contained in:
dogeystamp 2024-08-14 22:49:22 -04:00
parent 72e4a9f3c7
commit 73aa4f5f23
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -0,0 +1,30 @@
{{- /* symlink into ~/.config and ~/.local/share/ on windows */ -}}
{{- $roamingconfdirs := list "alacritty" "nushell" -}}
{{- $localconfdirs := list "nvim" -}}
{{- $localdatadirs := list "nvim-data/site" -}}
{{- if eq .chezmoi.os "windows" -}}
$userdir = ([Environment]::GetFolderPath("UserProfile"))
$roamingconfdir = ([Environment]::GetFolderPath("ApplicationData"))
$localconfdir = ([Environment]::GetFolderPath("LocalApplicationData"))
{{ range $roamingconfdirs }}
If (-Not (Test-Path $roamingconfdir\{{ . }})) {
New-Item -Path $roamingconfdir\{{ . }} -ItemType Junction -Value $userdir\.config\{{ . }}
}
{{ end }}
{{ range $localconfdirs }}
If (-Not (Test-Path $localconfdir\{{ . }})) {
New-Item -Path $localconfdir\{{ . }} -ItemType Junction -Value $userdir\.config\{{ . }}
}
{{ end }}
{{ range $localdatadirs }}
If (-Not (Test-Path $localconfdir\{{ . }})) {
New-Item -Path $localconfdir\{{ . }} -ItemType Junction -Value $userdir\.local\share\{{ . }}
}
{{ end }}
{{- end -}}