Skip to content
This repository has been archived by the owner on Feb 18, 2025. It is now read-only.

Remove option-ext dependency #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/dirs-dev/dirs-sys-rs"
maintenance = { status = "as-is" }

[dependencies]
option-ext = "0.2.0"

[target.'cfg(unix)'.dependencies]
libc = "0.2"

Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extern crate option_ext;

use std::ffi::OsString;
use std::path::PathBuf;

Expand Down
4 changes: 1 addition & 3 deletions src/xdg_user_dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use std::os::unix::ffi::OsStringExt;
use std::path::{Path, PathBuf};
use std::str;

use option_ext::OptionExt;

/// Returns all XDG user directories obtained from $(XDG_CONFIG_HOME)/user-dirs.dirs.
pub fn all(home_dir_path: &Path, user_dir_file_path: &Path) -> HashMap<String, PathBuf> {
let bytes = read_all(user_dir_file_path).unwrap_or(Vec::new());
Expand All @@ -34,7 +32,7 @@ fn parse_user_dirs(home_dir: &Path, user_dir: Option<&str>, bytes: &[u8]) -> Has
let key = if key.starts_with(b"XDG_") && key.ends_with(b"_DIR") {
match str::from_utf8(&key[4..key.len()-4]) {
Ok(key) =>
if user_dir.contains(&key) {
if user_dir == Some(key) {
single_dir_found = true;
key
} else if user_dir.is_none() {
Expand Down