From 783f7d2c7eb8ae632b93d8a3d7d8560e7ce790fd Mon Sep 17 00:00:00 2001 From: 160R <160R@protonmail.com> Date: Tue, 22 Nov 2022 19:42:00 +0100 Subject: [PATCH] fix for $PWD; bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- PKGBUILD | 2 +- src/picker/main.rs | 10 +++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9eba7b..413a594 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -389,7 +389,7 @@ checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" [[package]] name = "page" -version = "4.0.0" +version = "4.0.1" dependencies = [ "async-trait", "atty", diff --git a/Cargo.toml b/Cargo.toml index 5c61a3e..e0158ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "page" -version = "4.0.0" +version = "4.0.1" authors = ["160R <160R@protonmail.com>"] description = "Pager powered by neovim and inspired by neovim-remote" repository = "https://github.com/I60R/page" diff --git a/PKGBUILD b/PKGBUILD index 273bf93..d98c656 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ _pkgname=page pkgname=${_pkgname}-git pkgrel=1 -pkgver=v4.0.0 +pkgver=v4.0.1 pkgdesc='Pager powered by neovim and inspired by neovim-remote' arch=('i686' 'x86_64') url="https://github.com/I60R/page" diff --git a/src/picker/main.rs b/src/picker/main.rs index adeef5a..1ac5be5 100644 --- a/src/picker/main.rs +++ b/src/picker/main.rs @@ -168,6 +168,14 @@ mod open_files { context::EnvContext, }; + use once_cell::unsync::Lazy; + const PWD: Lazy = Lazy::new(|| { + PathBuf::from( + std::env::var("PWD") + .expect("Cannot read $PWD value") + ) + }); + pub struct FileToOpen { pub path: PathBuf, pub path_string: String, @@ -179,7 +187,7 @@ mod open_files { let path = match std::fs::canonicalize(&path) { Ok(canonical) => canonical, Err(e) if e.kind() == std::io::ErrorKind::NotFound => { - PathBuf::from(path.as_ref()) + PWD.join(path.as_ref()) } Err(e) => { log::error!(