Skip to content

Commit

Permalink
fix: Use fullpath for home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkuridza authored and alesbrelih committed Apr 19, 2024
1 parent 23ccc2b commit 3e8befd
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 4 deletions.
80 changes: 80 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ reqwest = { version = "0.12.3", features = ["blocking"] }
regex = "1.10.4"
serde_yaml = "0.9.34"
crc64 = "2.0.0"
dirs = "5.0.1"

[lints.clippy]
all = "deny"
Expand Down
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ fn default_log_path() -> String {
}

fn default_cache_path() -> String {
format!(
"{}/.gitlab-ci-ls/cache/",
std::env::var("HOME").unwrap_or_default()
)
let home = match dirs::home_dir() {
Some(path) => path.display().to_string(),
None => std::env::var("HOME").unwrap_or_default(),
};

format!("{home}/.gitlab-ci-ls/cache/")
}

#[allow(clippy::too_many_lines)]
Expand Down

0 comments on commit 3e8befd

Please sign in to comment.