Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions scripts/dotfiles/create
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ set -euo pipefail
source "$DOTLY_PATH/scripts/core/_main.sh"

dotfiles::apply_templating() {
PRINT_PATH=$(dotfiles::separate_dotpath_if_defalut_path)
if platform::is_macos; then
sed -i '' -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv"
sed -i '' -e "s|XXX_DOTFILES_PATH_XXX|$PRINT_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv"
else
sed -i -e "s|XXX_DOTFILES_PATH_XXX|$DOTFILES_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv"
sed -i -e "s|XXX_DOTFILES_PATH_XXX|$PRINT_PATH|g" "$DOTFILES_PATH/shell/zsh/.zshenv"
fi
}

dotfiles::separate_dotpath_if_defalut_path() {
if grep -q "^$HOME*" <<< "$DOTFILES_PATH"; then
ONLY_DOTPATH=$(echo $DOTFILES_PATH | awk -F"$HOME" '{ print $2 }')
echo '$HOME'$ONLY_DOTPATH
else
echo '$DOTFILES_PATH'
fi
}

Expand Down