Create the same file differently, depending on a condition? #2277
-
I’d like I know how to create a conditional symbolic link with templates. I think the problem is how to create the directory conditionally. If I understand it correctly, creating an empty directory is like
Even I make |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Currently, there is no way for the same path (
In your
in
This will make |
Beta Was this translation helpful? Give feedback.
Currently, there is no way for the same path (
~/.cache
) to have different types on different machines. However, there is a work-around for this specific case.~/.cache
is a directory on Linux by default, so you can ignore it on Linux, and then make it a symlink on macOS. For example (not tested):In your
.chezmoiignore
:in
~/.local/share/chezmoi/symlink_dot_cache
:This will make
~/.cache
a symlink to~/Library/Caches
on macOS and ignore~/.cache
on all other OSes.