From aa260899d452bde337e5e1a42e92ea6331ec9fc7 Mon Sep 17 00:00:00 2001 From: Zhenhui Xie Date: Thu, 24 Oct 2019 18:37:44 +0800 Subject: fix: Use logical path instead of physical path when available (#398) * Get pathbuf from logical path. (fixes #204) (also fixes #397) * fix: Update directory module so that use_logical_path will work properly * Remove test directory::use_logical_and_physical_paths * Fix merge errors Co-authored-by: Matan Kushner --- src/context.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/context.rs') diff --git a/src/context.rs b/src/context.rs index 936dce9db..f1ab29977 100644 --- a/src/context.rs +++ b/src/context.rs @@ -39,7 +39,12 @@ impl<'a> Context<'a> { let path = arguments .value_of("path") .map(From::from) - .unwrap_or_else(|| env::current_dir().expect("Unable to identify current directory.")); + .unwrap_or_else(|| { + env::var("PWD").map(PathBuf::from).unwrap_or_else(|err| { + log::debug!("Unable to get path from $PWD: {}", err); + env::current_dir().expect("Unable to identify current directory.") + }) + }); Context::new_with_dir(arguments, path) } -- cgit v1.2.3