dotly
dotly copied to clipboard
Feat/Fix to mitigate bugs when you have different usernames on different computers
Description
Use $HOME variable when defining $DOTFILES_PATH in .zshenv file when first installing dotly to mitigate bugs when you have different usernames on different computers
Motivation
At work they gave me a mac mini already configured with a username, there I started creating dotfiles and installing dotly, recently I bought a mac for me and installing dotly, when I imported my dotfiles, the username in .zshenv was different for what it launched an error since on my computer I had a username and another at work. I solved it easily by changing in .zshenv the variable /Users/nameuser/.dotfiles for $ HOME / .dotfiles
At the beginning of the error and newbie using dotly scared me a lot XD
It's easy to fix, but I think maybe it would be good if it was added in the .zshenv file when installing if the path is the default one.
This was done in eternal pending PR #129
In the proposal was done by changing fullpath for a path with $HOME
if is the same current path in dot dotbot create
script as yours.
The solution is simpler by using string substitution:
sed -i -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "${DOTFILES_PATH//$HOME/\$HOME}/shell/zsh/.zshenv"
I understand that, but even when I do it this way, in my .zshenv file I would still write the full path that is:
export DOTFILES_PATH="/Users/username/.dotfiles"
export DOTLY_PATH="$DOTFILES_PATH/modules/dotly"
export DOTLY_THEME="codely"
export ZIM_HOME="$DOTLY_PATH/modules/zimfw"
so on my personal computer in the .zshenv file:
export DOTFILES_PATH="/Users/username/.dotfiles"
and at work or other computer:
export DOTFILES_PATH="/Users/othername/.dotfiles"
so if what you write in the .zshenv file is the $HOME variable:
export DOTFILES_PATH="$HOME/.dotfiles"
so there would no longer be a problem with the username it could be any username
Yes, I understand the problem. I had the same :)