From 08358acd6e4847c15a5c300309d9e6efe2d16329 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Thu, 15 Aug 2024 17:23:22 -0400 Subject: [PATCH] chezmoi: windows local appdata symlink --- ...run_after__symlink-config_windows.ps1.tmpl | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/run_after__symlink-config_windows.ps1.tmpl b/src/run_after__symlink-config_windows.ps1.tmpl index 81da457..d5eb605 100644 --- a/src/run_after__symlink-config_windows.ps1.tmpl +++ b/src/run_after__symlink-config_windows.ps1.tmpl @@ -1,13 +1,23 @@ {{- /* symlink into ~/.config on windows */ -}} -{{- $confdirs := list "nvim" "alacritty" "nushell" -}} +{{- $roamingconfdirs := list "alacritty" "nushell" -}} +{{- $localconfdirs := list "nvim" -}} {{- if eq .chezmoi.os "windows" -}} -$confdir = ([Environment]::GetFolderPath("ApplicationData")) $userdir = ([Environment]::GetFolderPath("UserProfile")) -{{ range $confdirs }} -If (-Not (Test-Path $confdir\{{ . }})) { - New-Item -Path $confdir\{{ . }} -ItemType Junction -Value $userdir\.config\{{ . }} +$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 }} + {{- end -}}