fix: Use dirs crate for home_dir() function
This commit is contained in:
parent
e578f2d19c
commit
b770b59e7b
8 changed files with 10 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1406,6 +1406,7 @@ version = "1.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blocking",
|
"blocking",
|
||||||
"const_format",
|
"const_format",
|
||||||
|
"dirs 4.0.0",
|
||||||
"futures-lite",
|
"futures-lite",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
@ -1429,6 +1430,7 @@ version = "1.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-pidfd",
|
"async-pidfd",
|
||||||
|
"dirs 4.0.0",
|
||||||
"flume",
|
"flume",
|
||||||
"fork",
|
"fork",
|
||||||
"freedesktop-desktop-entry",
|
"freedesktop-desktop-entry",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ members = ["bin", "plugins", "service"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
blocking = "1.2.0"
|
blocking = "1.2.0"
|
||||||
const_format = "0.2.22"
|
const_format = "0.2.22"
|
||||||
|
dirs = "4.0.0"
|
||||||
futures-lite = "1.12.0"
|
futures-lite = "1.12.0"
|
||||||
serde = { version = "1.0.136", features = ["derive"] }
|
serde = { version = "1.0.136", features = ["derive"] }
|
||||||
serde_json = "1.0.79"
|
serde_json = "1.0.79"
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,4 @@ url = "2.2.2"
|
||||||
sysfs-class = "0.1.3"
|
sysfs-class = "0.1.3"
|
||||||
anyhow = "1.0.56"
|
anyhow = "1.0.56"
|
||||||
flume = "0.10.12"
|
flume = "0.10.12"
|
||||||
|
dirs = "4.0.0"
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ impl Default for App {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
entries: BTreeMap::default(),
|
entries: BTreeMap::default(),
|
||||||
home: std::env::home_dir().expect("no home dir"),
|
home: dirs::home_dir().expect("no home dir"),
|
||||||
out: async_stdout(),
|
out: async_stdout(),
|
||||||
search_results: Vec::with_capacity(100),
|
search_results: Vec::with_capacity(100),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ impl App {
|
||||||
let mut queue = VecDeque::new();
|
let mut queue = VecDeque::new();
|
||||||
|
|
||||||
queue.push_back(
|
queue.push_back(
|
||||||
std::env::home_dir()
|
dirs::home_dir()
|
||||||
.expect("user does not have home dir")
|
.expect("user does not have home dir")
|
||||||
.join(LOCAL_PATH),
|
.join(LOCAL_PATH),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ const ALLOWED_FAVICON_MIME: [&str; 5] = [
|
||||||
|
|
||||||
impl Default for App {
|
impl Default for App {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let cache = std::env::home_dir()
|
let cache = dirs::home_dir()
|
||||||
.map(|cache| cache.join(".cache/pop-launcher"))
|
.map(|cache| cache.join(".cache/pop-launcher"))
|
||||||
.expect("no home dir");
|
.expect("no home dir");
|
||||||
|
|
||||||
|
|
@ -228,8 +228,7 @@ async fn favicon_url_from_page_source(domain: &str, client: &HttpClient) -> Opti
|
||||||
.text()
|
.text()
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.map(|html| parse_favicon(&html))
|
.and_then(|html| parse_favicon(&html))
|
||||||
.flatten()
|
|
||||||
.map(|icon_url| {
|
.map(|icon_url| {
|
||||||
if !icon_url.starts_with("https://") {
|
if !icon_url.starts_with("https://") {
|
||||||
format!("https://{}{}", domain, icon_url)
|
format!("https://{}{}", domain, icon_url)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ pub struct PluginBinary {
|
||||||
path: Cow<'static, str>,
|
path: Cow<'static, str>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
#[allow(dead_code)]
|
||||||
args: Vec<Cow<'static, str>>,
|
args: Vec<Cow<'static, str>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ pub fn plugin_paths() -> impl Iterator<Item = Cow<'static, Path>> {
|
||||||
PLUGIN_PATHS.iter().map(|path| {
|
PLUGIN_PATHS.iter().map(|path| {
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
if let Some(path) = path.strip_prefix("~/") {
|
if let Some(path) = path.strip_prefix("~/") {
|
||||||
let path = std::env::home_dir()
|
let path = dirs::home_dir()
|
||||||
.expect("user does not have home dir")
|
.expect("user does not have home dir")
|
||||||
.join(path);
|
.join(path);
|
||||||
Cow::Owned(path)
|
Cow::Owned(path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue