Skip to content

home_dir is lying about its functionality on Unix systems #22

@tesuji

Description

@tesuji

home uses std::env::home_dir for non Windows systems and states that

home/src/lib.rs

Lines 42 to 43 in 3a6eccd

/// Returns the value of the `HOME` environment variable if it is set
/// and not equal to the empty string. Otherwise, it tries to determine the

but after https://github.com/rust-lang/rust/pull/51656/files#diff-b596503c7c33ce457b6d047e351ac12bR516, Rust changes home_dir doc on Unixes.

There are two way to move forward now:

  • Correct documentation by copying std::env::home_dir doc.
    After all, POSIX requires systems to init "HOME" env after user loging: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html

  • Re-implement for all UNIX targets, this is harmful for maintenance. Because unlike Windows,
    there are many Unix systems worth considering to support.

    • Use dirs-sys crate for implementation part.

cc @brson for advice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions