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

Config and save directories according to XDG Base Directory specification #1954

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bugwrit3r
Copy link

Config directory gets created in $XDG_CONFIG_HOME/.ja2 or $HOME/.config/.ja2 if variable is unset.
Save directory gets created in $XDG_DATA_HOME/,ja2 or $HOME/.local/.share/.ja2 if variable is unset.
$HOME/.ja2 is used if it's already present.

@lynxlynxlynx lynxlynxlynx linked an issue Jan 15, 2024 that may be closed by this pull request
@lynxlynxlynx
Copy link
Member

$HOME/.local/.share/.ja2 should be $HOME/.local/share/ja2 (or with an expanded final name).

@bugwrit3r
Copy link
Author

bugwrit3r commented Jan 15, 2024

$HOME/.local/.share/.ja2 should be $HOME/.local/share/ja2 (or with an expanded final name).

It should be that now but I broke some tests for appveyor and I don't know how to fix them. It works on my machine though.
EDIT: I think there must be separate tests for windows and unix-like with my changes.

@@ -10,7 +10,13 @@ const STRACCIATELLA_HOME_DIR_NAME: &str = "JA2";
/// Find ja2 stracciatella configuration directory inside the user's home directory or the android app dir
pub fn find_stracciatella_home() -> Result<PathBuf, String> {
#[cfg(not(target_os = "android"))]
let base = dirs::home_dir();
let base: Option<PathBuf>;
if Path::new(&format!("{}/{}", std::env::var("HOME").unwrap(), STRACCIATELLA_HOME_DIR_NAME)).is_dir() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it broken here now, with the latest change? ~/ja2 is not a good dir.

@lynxlynxlynx
Copy link
Member

Hey @bugwrit3r, any plans on finishing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use XDG base directories by default under Linux
2 participants