Skip to content
Snippets Groups Projects
Commit 1a8107b0 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Have get_syncterm_filename() get the system cache path too

Now we can easily try downloading a URI when it's configured.
Still can't save the changes though.
parent cd38cdb9
No related branches found
No related tags found
No related merge requests found
Pipeline #8032 failed
......@@ -2974,9 +2974,24 @@ edit_web_lists(void)
// TODO: Help
if (uifc.input(WIN_SAV | WIN_MID, 0, 0, "Web List URI", tmpv, sizeof(tmpv) - 1, K_EDIT) != -1
&& tmpv[0]) {
char cache_path[MAX_PATH + 1];
if (get_syncterm_filename(cache_path, sizeof(cache_path), SYNCTERM_PATH_SYSTEM_CACHE, false)) {
struct webget_request req;
if (!init_webget_req(&req, cache_path, tmpn, tmpv) || !iniReadHttp(&req)) {
char temp[1024];
snprintf(temp, sizeof(temp), "Can't fetch URI: %s", req.msg);
uifc.msg(temp);
}
else {
namedStrListInsert(&settings.webgets, tmpn, tmpv, i & MSK_OFF);
changed = true;
}
}
else {
namedStrListInsert(&settings.webgets, tmpn, tmpv, i & MSK_OFF);
changed = true;
}
}
break;
}
}
......
......@@ -1446,6 +1446,16 @@ get_syncterm_filename(char *fn, int fnlen, int type, bool shared)
sprintf(fn, "%.*s", fnlen - 1, list_override);
return fn;
}
// Get recursive for the system cache...
if (type == SYNCTERM_PATH_SYSTEM_CACHE) {
if (!get_syncterm_filename(fn, fnlen, SYNCTERM_PATH_CACHE, false))
return NULL;
backslash(fn);
strlcat(fn, "syncterm-system-cache", fnlen);
mkpath(fn);
return fn;
}
memset(fn, 0, fnlen);
#if defined(__APPLE__) && defined(__MACH__)
return get_OSX_filename(fn, fnlen, type, shared);
......@@ -2168,11 +2178,7 @@ main(int argc, char **argv)
init_uifc(true, true);
char cache_path[MAX_PATH + 1];
if (get_syncterm_filename(cache_path, sizeof(cache_path), SYNCTERM_PATH_CACHE, false)) {
backslash(cache_path);
strlcat(cache_path, "syncterm-system-cache", sizeof(cache_path));
mkpath(cache_path);
if (get_syncterm_filename(cache_path, sizeof(cache_path), SYNCTERM_PATH_SYSTEM_CACHE, false)) {
size_t items;
size_t started = 0;
COUNT_LIST_ITEMS(settings.webgets, items);
......
......@@ -14,15 +14,12 @@
#endif
enum {
SYNCTERM_PATH_INI
,
SYNCTERM_PATH_LIST
,
SYNCTERM_DEFAULT_TRANSFER_PATH
,
SYNCTERM_PATH_CACHE
,
SYNCTERM_PATH_KEYS
SYNCTERM_PATH_INI,
SYNCTERM_PATH_LIST,
SYNCTERM_DEFAULT_TRANSFER_PATH,
SYNCTERM_PATH_CACHE,
SYNCTERM_PATH_KEYS,
SYNCTERM_PATH_SYSTEM_CACHE
};
/* Default modem device */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment