mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
fallback to ~/.hashcat if the xdg base directory does not exist
This commit is contained in:
parent
d018469aef
commit
964eb51dd9
12
src/folder.c
12
src/folder.c
@ -97,14 +97,22 @@ static void get_profile_dir (char *profile_dir, const char *home_dir)
|
||||
if (stat (profile_dir, &st) == 0 && S_ISDIR (st.st_mode))
|
||||
return;
|
||||
|
||||
char *data_dir = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
if (getenv("XDG_DATA_HOME"))
|
||||
{
|
||||
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", getenv("XDG_DATA_HOME"));
|
||||
strncpy (data_dir, getenv("XDG_DATA_HOME"), HCBUFSIZ_TINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/.local/share/hashcat", home_dir);
|
||||
snprintf (data_dir, HCBUFSIZ_TINY, "%s/.local/share", home_dir);
|
||||
}
|
||||
|
||||
if (access (data_dir, R_OK) != -1)
|
||||
{
|
||||
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", data_dir);
|
||||
}
|
||||
|
||||
hcfree (data_dir);
|
||||
}
|
||||
|
||||
static void get_session_dir (char *session_dir, const char *profile_dir)
|
||||
|
Loading…
Reference in New Issue
Block a user