diff options
author | Zhenhui Xie <xiezh0831@yahoo.co.jp> | 2019-10-24 18:37:44 +0800 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-10-24 19:37:44 +0900 |
commit | aa260899d452bde337e5e1a42e92ea6331ec9fc7 (patch) | |
tree | 115702797f574c430344f183dbfb11952be079e3 /src/context.rs | |
parent | e0c90a6502b1acd4454f150e0003c63c4fac5208 (diff) |
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 <hello@matchai.me>
Diffstat (limited to 'src/context.rs')
-rw-r--r-- | src/context.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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) } |