Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add Windows support #58

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
Next Next commit
✨ it compiles in Windows!
AucaCoyan committed Dec 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e2f6953546425a069d17ab0eda0726bc9c1b42bf
49 changes: 49 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
@@ -21,6 +21,7 @@ chrono = "0.4.38"
clap = { version = "4.5.17", features = ["derive"] }
color-eyre = "0.6.3"
console = "0.15.8"
directories = "5.0.1"
fxhash = "0.2.1"
image = "0.25.2"
ratatui = "0.28.1"
14 changes: 9 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ pub fn load() -> (UiConfig, GraphConfig, Option<KeyBind>) {
read_config_from_path(&user_path)
}
None => {
let default_path = xdg_config_file_path();
let default_path = config_file_path();
if default_path.exists() {
read_config_from_path(&default_path)
} else {
@@ -51,10 +51,14 @@ fn config_file_path_from_env() -> Option<PathBuf> {
env::var(CONFIG_FILE_ENV_NAME).ok().map(PathBuf::from)
}

fn xdg_config_file_path() -> PathBuf {
xdg::BaseDirectories::with_prefix(APP_DIR_NAME)
.unwrap()
.get_config_file(CONFIG_FILE_NAME)
fn config_file_path() -> PathBuf {
use directories::BaseDirs;

BaseDirs::new()
.expect("Couldn't get the base user directories!")
.config_dir()
.join(APP_DIR_NAME)
.join(CONFIG_FILE_NAME)
}

fn read_config_from_path(path: &Path) -> Config {