use XDG_DATA_HOME for profile_dir

pull/2456/head
nycex 4 years ago
parent 918a621506
commit 8d78815767
No known key found for this signature in database
GPG Key ID: EE6FBE8D3E7278A5

@ -31,7 +31,7 @@ The install target is linux FHS compatible and can be used like this:
$ make install
```
If you install it, cached kernels, session files, restore- and pot-files etc. will go to $HOME/.hashcat/
If you install it, cached kernels, session files, restore- and pot-files etc. will go to either $HOME/.hashcat/, if that already exists, otherwise to $XDG_DATA_HOME/hashcat/ or ~/.local/share/hashcat/, if that environment variable is not set.
### Building hashcat for Windows (using Windows Subsystem for Linux) ###

@ -93,6 +93,15 @@ static void get_install_dir (char *install_dir, const char *exec_path)
static void get_profile_dir (char *profile_dir, const char *home_dir)
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/%s", home_dir, DOT_HASHCAT);
struct stat st = {0};
if (stat(profile_dir, &st) == 0 && S_ISDIR(st.st_mode))
return;
if (getenv("XDG_DATA_HOME")) {
snprintf(profile_dir, HCBUFSIZ_TINY, "%s/hashcat", getenv("XDG_DATA_HOME"));
} else {
snprintf(profile_dir, HCBUFSIZ_TINY, "%s/.local/share/hashcat", home_dir);
}
}
static void get_session_dir (char *session_dir, const char *profile_dir)

Loading…
Cancel
Save