Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Riey committed Jan 25, 2024
1 parent 0560f33 commit 8ec638e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fontconfig-parser"
version = "0.5.3"
version = "0.5.4"
edition = "2018"
license = "MIT"
documentation = "https://docs.rs/fontconfig-parser"
Expand All @@ -16,13 +16,13 @@ serialize = ["serde"]

[dependencies]
log = { version = "0.4", optional = true }
roxmltree = "0.18"
roxmltree = "0.19"
serde = { version = "1", optional = true, features = ["derive"] }

[dev-dependencies]
criterion = "0.5"
glob = "0.3"
k9 = "0.11"
k9 = "0.12"
serde_yaml = "0.9"

[[bench]]
Expand Down
28 changes: 18 additions & 10 deletions src/types/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ fn config_home() -> Result<String, std::env::VarError> {
/// This is a simplified version of `FcConfigGetFilename` from the Fontconfig
/// library.
fn config_get_file_name(p: &std::path::PathBuf) -> std::path::PathBuf {
#[cfg(target_os = "windows")]
{
if cfg!(target_os = "windows") {
// TODO: get config file path properly for Windows
return p.clone();
} else {
std::path::Path::new("/etc/fonts").join(p)
}
std::path::Path::new("/etc/fonts").join(p)
}

fn expand_tilde(path: &String) -> std::path::PathBuf {
Expand All @@ -117,7 +117,7 @@ macro_rules! define_calculate_path {
DirPrefix::Default => Self::DEFAULT_PREFIX_BEHAVIOR,
DirPrefix::Cwd => PrefixBehavior::Cwd,
DirPrefix::Xdg => PrefixBehavior::Xdg,
DirPrefix::Relative => PrefixBehavior::Relative
DirPrefix::Relative => PrefixBehavior::Relative,
}
}

Expand All @@ -142,10 +142,8 @@ macro_rules! define_calculate_path {
None => std::path::Path::new(".").join(expanded_path),
},
PrefixBehavior::Xdg => {
let xdg_path = std::env::var($xdg_env)
.unwrap_or_else(|_|
$xdg_fallback.into()
);
let xdg_path =
std::env::var($xdg_env).unwrap_or_else(|_| $xdg_fallback.into());
expand_tilde(&xdg_path).join(expanded_path)
}
}
Expand All @@ -156,5 +154,15 @@ macro_rules! define_calculate_path {

define_calculate_path!(Dir, "XDG_DATA_HOME", "~/.local/share", PrefixBehavior::Cwd);
define_calculate_path!(CacheDir, "XDG_CACHE_HOME", "~/.cache", PrefixBehavior::Cwd);
define_calculate_path!(Include, "XDG_CONFIG_HOME", "~/.config", PrefixBehavior::Config);
define_calculate_path!(RemapDir, "XDG_CONFIG_HOME", "~/.config", PrefixBehavior::Cwd);
define_calculate_path!(
Include,
"XDG_CONFIG_HOME",
"~/.config",
PrefixBehavior::Config
);
define_calculate_path!(
RemapDir,
"XDG_CONFIG_HOME",
"~/.config",
PrefixBehavior::Cwd
);

0 comments on commit 8ec638e

Please sign in to comment.