fix: check relative path on expand_path (#165)

This commit is contained in:
三咲雅 · Misaki Masa 2023-09-17 01:29:44 +08:00 committed by GitHub
parent 902c094224
commit 8e72ae90c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
use std::{cmp::Ordering, collections::BTreeMap, mem, ops::Deref}; use std::{cmp::Ordering, collections::BTreeMap, mem};
use config::{manager::SortBy, MANAGER}; use config::{manager::SortBy, MANAGER};
use shared::Url; use shared::Url;

View File

@ -11,7 +11,10 @@ pub fn expand_path(p: impl AsRef<Path>) -> PathBuf {
return PathBuf::from_iter([&home, p.as_os_str()]); return PathBuf::from_iter([&home, p.as_os_str()]);
} }
} }
p.to_path_buf() if p.is_absolute() {
return p.to_path_buf();
}
env::current_dir().map_or_else(|_| p.to_path_buf(), |c| c.join(p))
} }
#[inline] #[inline]