diff options
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); |