z
z copied to clipboard
cached Z_DATA path not portable
Sorry if this is not a z issue, but a fish thing. I am new to both.
In z.fish
, it sets Z_DATA
and some other vars that include the $HOME directory. Unfortunately, $HOME is different for me on different machines, so I get errors when Z_DATA
points to the data path of another machine.
Any way to fix that? Is it a fish thing? Thanks!
I think you are referring to setting some universal variables, which get written to ~/.config/fish_variables, like this:
SETUVAR Z_DATA:/home/mark/\x2elocal/share/z/data
SETUVAR Z_DATA_DIR:/home/mark/\x2elocal/share/z
The code says it only sets those universal variables of Z_DATA
is not set. It uses if test -z "$Z_DATA"
. According to man test
, this is checking if Z_DATA is zero-length or not.
https://github.com/jethrokuan/z/blob/master/conf.d/z.fish
So the solution is set Z_DATA
on both of your machines with different values.
The document already recommends setting Z_DATA explicily: https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration)https://github.com/jethrokuan/z/blob/master/man/man1/z.md#configuration
Uhm... this means we should set Z_DATA
explicitly to the home path value in every machine... something that should be the default actually. Doesn't sound very clean.
Also, I can't see where the documentation "recommends" to set Z_DATA
explicitly -- perhaps it has been edited in the meanwhile?
For reference, Fisher itself fixed this very issue here, so IMHO a similar approach could be considered.
Here's my workaround for this: https://github.com/itsfarseen/dotfiles/blob/3df373b321e8f240eaba169611bfe9adab86c514/config/fish/conf.d/_z-make-portable.fish
More context: https://github.com/jorgebucaran/fisher/pull/746
I think this issue can be closed. Multiple comments have documented solutions that don't require modifying the code here.