dotly icon indicating copy to clipboard operation
dotly copied to clipboard

Feat/Fix to mitigate bugs when you have different usernames on different computers

Open mmorenoregalado opened this issue 3 years ago • 3 comments

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.

mmorenoregalado avatar Jun 11 '21 22:06 mmorenoregalado

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"

gtrabanco avatar Jun 12 '21 10:06 gtrabanco

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

mmorenoregalado avatar Jun 13 '21 22:06 mmorenoregalado

Yes, I understand the problem. I had the same :)

gtrabanco avatar Jun 14 '21 12:06 gtrabanco