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

[Shell] Environment Variable "DOTFILES" Auto Detection Can't Support Absolute Path #8

Open
Johnson9009 opened this issue Jul 2, 2023 · 0 comments
Assignees
Labels
P1 High

Comments

@Johnson9009
Copy link
Owner

Currently only if the shell initialization file (.zshrc) is a relative link, then the env "DOTFILES" can be set correctly by the logic of file shell/zsh/zshrc because of below code.

dotfiles/shell/zsh/zshrc

Lines 75 to 89 in 88e1a6d

# Setting the full path of our dotfiles directory automatically.
# This script can be executed through 3 different ways.
# - Executed directly by shell through symbolic link(e.g., ~/.zshrc -> zshrc)
# - sourced by other script through symbolic link(e.g., source ~/.zshrc)
# - sourced by other script directly(e.g., source zshrc)
# Below line of code can get the full path of this script no matter how this
# script is executed.
SHRC=${(%):-%x}
# Resolve the real path of this script, if it is a symbolic link.
while [[ -L ${SHRC} ]]; do
SHRC=`dirname ${SHRC}`/`readlink ${SHRC}`
done
OLD_DIR=`pwd`; cd `dirname ${SHRC}`/../..; unset SHRC
export DOTFILES=`pwd`
cd ${OLD_DIR}; unset OLD_DIR

@Johnson9009 Johnson9009 added the P1 High label Jul 2, 2023
@Johnson9009 Johnson9009 self-assigned this Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High
Projects
None yet
Development

No branches or pull requests

1 participant