From efd2230eba28cea6265288315e80ca1be96783c2 Mon Sep 17 00:00:00 2001 From: Patrick Decat Date: Wed, 15 Mar 2023 00:15:39 +0100 Subject: Prefer PWD environment variable over cwd if available to better support symbolic links (#783) --- atuin-client/src/database.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'atuin-client') diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index d19a0b74..3b579153 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -1,6 +1,7 @@ use std::{env, path::Path, str::FromStr}; use async_trait::async_trait; +use atuin_common::utils; use chrono::{prelude::*, Utc}; use fs_err as fs; use itertools::Itertools; @@ -31,10 +32,7 @@ pub fn current_context() -> Context { std::process::exit(1); }; let hostname = format!("{}:{}", whoami::hostname(), whoami::username()); - let cwd = match env::current_dir() { - Ok(dir) => dir.display().to_string(), - Err(_) => String::from(""), - }; + let cwd = utils::get_current_dir(); Context { session, -- cgit v1.3.1