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

improve $HOME detection for superuser on macOS (fixes #219) #221

Closed
wants to merge 1 commit into from
Closed

improve $HOME detection for superuser on macOS (fixes #219) #221

wants to merge 1 commit into from

Conversation

LucaFilipozzi
Copy link
Contributor

On macOS, root's $HOME is '/var/root' but '/var' is a symlink to '/var/private'. Consequently, $HOME ('/var/'root') never matches a normalized $PWD ('/var/private/root') and '~' is never displayed.

On macOS, root's $HOME is '/var/root' but '/var' is a symlink to '/var/private'. Consequently, $HOME ('/var/'root') never matches a normalized $PWD ('/var/private/root') and '~' is never displayed.
@@ -359,7 +359,7 @@ function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened for
switch "$segment_dir"
case /
set directory '/'
case "$HOME"
case (builtin realpath "$HOME")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do case "$HOME" (builtin realpath "$HOME"). the string comparison should be enough cheaper than a filesystem lookup that it's probably worth doing.

@LucaFilipozzi
Copy link
Contributor Author

Cosing this pull request as I've reworked the __bobthefish_git_project_dir and __bobthefish_hg_project_dir functions. I'll generate a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants