diff options
author | Cem Keylan <cem@ckyln.com> | 2021-09-29 00:42:23 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2021-09-29 00:42:23 +0300 |
commit | b402bac6f49519770f84d3667012cfd636c910a9 (patch) | |
tree | 3717d8f6ae4a9874c89f1231d122f5e2f25c18bb /browser.c | |
parent | 061c9b553bb2742682ea9b15dfe5a8f98ef90500 (diff) | |
download | lariza-b402bac6f49519770f84d3667012cfd636c910a9.tar.gz |
grab_environment_configuration(): complexify download directory :)
Diffstat (limited to 'browser.c')
-rw-r--r-- | browser.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -681,7 +681,21 @@ grab_environment_configuration(void) if (e != NULL) accepted_language[0] = g_strdup(e); + /* + * Accept XDG_DOWNLOAD_DIR as a valid download directory if + * LARIZA_DOWNLOAD_DIR is not specifically set. Since the XDG user directory + * specification is extremely stupid, and depends on a certain xdg-user-dir + * binary, we do two runs for acquiring the XDG_DOWNLOAD_DIR. We look at the + * environment variables (which what this specification should have been), + * and use g_get_user_special_dir() if that fails. + */ e = g_getenv(__NAME_UPPERCASE__"_DOWNLOAD_DIR"); + if (e == NULL) + e = g_getenv("XDG_DOWNLOAD_DIR"); + if (e == NULL) + e = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD); + if (e == NULL) + e = g_build_filename(g_get_home_dir(), "Downloads", NULL); if (e != NULL) download_dir = g_strdup(e); |