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

Expand ~/ in whitelist paths #931

Merged
merged 1 commit into from Apr 17, 2022

Commits on Apr 15, 2022

  1. Expand ~/ in whitelist paths

    Expand a path string prefixed with ~/ to the current user's home directory.
    
    Example: if current user is `user1` with home directory in `/home/user1`,
    then `~/project` -> `/home/user1/project`
    
    It's useful to allow paths with `~/`,  so that `direnv.toml` can be reused via
    dotfiles repos across systems with different standard home paths
    (compare Linux `/home` and macOS `/Users`).
    
    Feedback is welcome e.g. if/how this should be tested. For now manual
    testing of prefix & exact has been done confirming that full paths as
    well as `~/`-paths works.
    
    I looked here for how to expand tilde:
     https://gist.github.com/miguelmota/9ab72c5e342f833123c0b5cfd5aca468
    
    I also found a third party module that expands tilde
    https://github.com/prep/tilde
    that we can swap in instead of the `expandTildePath` method in this PR
    if desired. I assumed the project would like to minimize dependencies
    and made this simple function instead.
    
    Fixes direnv#926
    erikw committed Apr 15, 2022
    Configuration menu
    Copy the full SHA
    7530409 View commit details
    Browse the repository at this point in the history