Skip to content

Commit

Permalink
Read config file from $XDG_CONFIG_HOME/spotify-adblock/config.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
guihkx committed Sep 14, 2024
1 parent f6aa1a9 commit c5a5ae6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use lazy_static::lazy_static;
use libc::{addrinfo, c_char, dlsym, EAI_FAIL, RTLD_NEXT};
use regex::RegexSet;
use serde::Deserialize;
use std::{ffi::CStr, fs::read_to_string, mem, path::PathBuf, ptr::null, slice::from_raw_parts, string::String};
use std::{env, ffi::CStr, fs::read_to_string, mem, path::PathBuf, ptr::null, slice::from_raw_parts, string::String};

macro_rules! hook {
($function_name:ident($($parameter_name:ident: $parameter_type:ty),*) -> $return_type:ty => $new_function_name:ident $body:block) => {
Expand Down Expand Up @@ -42,7 +42,7 @@ lazy_static! {
let config_paths = vec![
PathBuf::from("config.toml"),
#[allow(deprecated)] // std::env::home_dir() is only broken on Windows
std::env::home_dir().unwrap().join(".config/spotify-adblock/config.toml"),
env::var("XDG_CONFIG_HOME").map_or(env::home_dir().unwrap(), PathBuf::from).join("spotify-adblock/config.toml"),
PathBuf::from("/etc/spotify-adblock/config.toml"),
];

Expand Down

0 comments on commit c5a5ae6

Please sign in to comment.