if (!path || *path == '\0') {
path = PROJECT "-download";
}
- file = g_build_filename(vb.config.download_dir, path, NULL);
+ file = util_build_path(path, vb.config.download_dir);
}
/* build the file uri from file path */
g_free(vb.config.download_dir);
vb.config.download_dir = NULL;
}
+
path = util_expand(s->arg.s);
- /* if path is not absolute set it in the home directory */
- if (*path != '/') {
- vb.config.download_dir = g_build_filename(util_get_home_dir(), path, NULL);
- g_free(path);
+ if (*path) {
+ /* if path is not absolute set it in the home directory */
+ if (*path != '/') {
+ vb.config.download_dir = g_build_filename(util_get_home_dir(), path, NULL);
+ g_free(path);
+ } else {
+ vb.config.download_dir = path;
+ }
+ /* create the path if it does not exist */
+ util_create_dir_if_not_exists(vb.config.download_dir);
} else {
+ /* set the empty path */
vb.config.download_dir = path;
}
- /* create the path if it does not exist */
- util_create_dir_if_not_exists(vb.config.download_dir);
}
return SETTING_OK;
* no need to free fexp, bacuse this should be done by the caller
* on fullPath later */
fullPath = fexp;
- } else if (dir) {
+ } else if (dir && *dir) {
/* try to expand also the dir given - this may be ~/path */
if ((dexp = util_expand(dir))) {
/* use expanded dir and append expanded path */