mirror of
https://github.com/imgurbot12/rmenu.git
synced 2025-02-04 17:25:00 +01:00
fix broken xdg path search
This commit is contained in:
parent
81f612ecbf
commit
b6ce0ccb52
5 changed files with 189 additions and 175 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
target
|
||||
# Cargo.lock
|
||||
result
|
||||
.idea
|
||||
|
|
350
Cargo.lock
generated
350
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "rmenu"
|
||||
version = "0.0.1"
|
||||
version = "1.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -30,3 +30,4 @@ shellexpand = "3.1.0"
|
|||
strfmt = "0.2.4"
|
||||
thiserror = "1.0.43"
|
||||
which = "4.4.0"
|
||||
xdg = "2.5.2"
|
||||
|
|
|
@ -10,7 +10,7 @@ use rmenu_plugin::{Entry, Message};
|
|||
use thiserror::Error;
|
||||
|
||||
use crate::config::{cfg_replace, Config, Keybind};
|
||||
use crate::{CONFIG_DIR, DEFAULT_CONFIG, DEFAULT_THEME};
|
||||
use crate::{DEFAULT_CONFIG, DEFAULT_THEME};
|
||||
|
||||
/// Allowed Formats for Entry Ingestion
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -182,8 +182,10 @@ impl Args {
|
|||
/// Find Configuration Path
|
||||
pub fn find_config(&self) -> PathBuf {
|
||||
self.config.clone().unwrap_or_else(|| {
|
||||
let cfgdir = std::env::var("XDG_CONFIG_DIR").unwrap_or_else(|_| CONFIG_DIR.to_string());
|
||||
PathBuf::from(cfgdir).join(DEFAULT_CONFIG)
|
||||
xdg::BaseDirectories::with_prefix("rmenu")
|
||||
.expect("Failed to read xdg base dirs")
|
||||
.find_config_file(DEFAULT_CONFIG)
|
||||
.unwrap_or_else(PathBuf::new)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "stable"
|
Loading…
Reference in a new issue