ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: fix SSH key discovery on Windows

$HOME isn't set here, but `dirs` has suitable magic for us already.
This commit is contained in:
Benjamin Saunders 2023-10-12 19:49:30 -07:00
parent 0aa5f1ae10
commit 7e7735e6b5

View file

@ -660,7 +660,7 @@ fn decode_assuan_data(encoded: &str) -> Option<String> {
#[tracing::instrument]
fn get_ssh_keys(_username: &str) -> Vec<PathBuf> {
let mut paths = vec![];
if let Ok(home_dir) = std::env::var("HOME") {
if let Some(home_dir) = dirs::home_dir() {
let ssh_dir = Path::new(&home_dir).join(".ssh");
for filename in ["id_ed25519_sk", "id_ed25519", "id_rsa"] {
let key_path = ssh_dir.join(filename);