Keep runtime files inside application support

This commit is contained in:
Georg Bauer
2026-07-28 18:34:08 +02:00
parent 31f6426eef
commit 9cf1c70a67
8 changed files with 141 additions and 108 deletions

View File

@@ -38,7 +38,6 @@ typedef struct {
} web_buf;
struct ds4_web {
char home[PATH_MAX];
char profile_dir[PATH_MAX];
int port;
pid_t chrome_pid;
@@ -1324,11 +1323,9 @@ static char *web_run_page_js(ds4_web *web, const char *url, const char *js,
ds4_web *ds4_web_create(const ds4_web_config *cfg) {
ds4_web *web = web_xmalloc(sizeof(*web));
memset(web, 0, sizeof(*web));
const char *home = cfg && cfg->home_dir && cfg->home_dir[0] ?
cfg->home_dir : getenv("HOME");
if (!home || !home[0]) home = ".";
snprintf(web->home, sizeof(web->home), "%s", home);
snprintf(web->profile_dir, sizeof(web->profile_dir), "%s/.ds4/browser", home);
const char *profile = cfg && cfg->profile_dir && cfg->profile_dir[0] ?
cfg->profile_dir : "browser";
snprintf(web->profile_dir, sizeof(web->profile_dir), "%s", profile);
web->port = cfg && cfg->port > 0 ? cfg->port : DS4_WEB_DEFAULT_PORT;
web->chrome_pid = 0;
web->next_cdp_id = 1;

View File

@@ -10,7 +10,7 @@ typedef void (*ds4_web_log_fn)(void *privdata, const char *message);
typedef bool (*ds4_web_cancel_fn)(void *privdata);
typedef struct {
const char *home_dir;
const char *profile_dir;
int port;
ds4_web_confirm_fn confirm;
void *confirm_privdata;