mirror of
https://github.com/owntracks/recorder.git
synced 2026-02-13 20:49:51 +00:00
s/JSONDIR/STORAGEDIR/g
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
#define JSONDIR "store"
|
||||
/*
|
||||
* This is the top-level directory you create; ot-recorder
|
||||
* stores files below this hierarchy and creates directories
|
||||
* therin by itself. Note that the user running `ot-recorder'
|
||||
* must be granted write access (rwx)
|
||||
*/
|
||||
|
||||
#define STORAGEDIR "/path/to/store"
|
||||
|
||||
/*
|
||||
* 1 => 5,009.4km x 4,992.6km
|
||||
|
||||
4
file.c
4
file.c
@@ -52,9 +52,9 @@ FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char *
|
||||
|
||||
if (device) {
|
||||
ut_lower(device);
|
||||
utstring_printf(path, "%s/%s/%s/%s", JSONDIR, prefix, utstring_body(user), utstring_body(device));
|
||||
utstring_printf(path, "%s/%s/%s/%s", STORAGEDIR, prefix, utstring_body(user), utstring_body(device));
|
||||
} else {
|
||||
utstring_printf(path, "%s/%s/%s", JSONDIR, prefix, utstring_body(user));
|
||||
utstring_printf(path, "%s/%s/%s", STORAGEDIR, prefix, utstring_body(user));
|
||||
}
|
||||
|
||||
ut_clean(path);
|
||||
|
||||
8
ghash.c
8
ghash.c
@@ -123,7 +123,7 @@ int ghash_readcache(struct udata *ud, char *ghash, UT_string *addr, UT_string *c
|
||||
|
||||
if (ud->usefiles) {
|
||||
/* if ghash file is available, read cc:addr into that */
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s/%s.json", JSONDIR, ghash, ghash);
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s/%s.json", STORAGEDIR, ghash, ghash);
|
||||
|
||||
// fprintf(stderr, "Reading GhashCache from %s\n", gfile);
|
||||
if ((fp = fopen(gfile, "r")) != NULL) {
|
||||
@@ -176,7 +176,7 @@ void ghash_storecache(struct udata *ud, JsonNode *geo, char *ghash, char *addr,
|
||||
#endif
|
||||
|
||||
if (ud->usefiles) {
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash", JSONDIR);
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
if (mkpath(gfile) < 0) {
|
||||
perror(gfile);
|
||||
} else {
|
||||
@@ -186,12 +186,12 @@ void ghash_storecache(struct udata *ud, JsonNode *geo, char *ghash, char *addr,
|
||||
json_append_member(geo, "cc", json_mkstring(ghash));
|
||||
|
||||
if ((js = json_stringify(geo, NULL)) != NULL) {
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s", JSONDIR, ghash);
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s", STORAGEDIR, ghash);
|
||||
if (mkpath(gfile) != 0) {
|
||||
perror(gfile);
|
||||
return;
|
||||
}
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s/%s.json", JSONDIR, ghash, ghash);
|
||||
snprintf(gfile, BUFSIZ, "%s/ghash/%-3.3s/%s.json", STORAGEDIR, ghash, ghash);
|
||||
|
||||
if ((fp = fopen(gfile, "w")) != NULL) {
|
||||
fprintf(fp, "%s\n", js);
|
||||
|
||||
2
misc.c
2
misc.c
@@ -47,7 +47,7 @@ void monitorhook(struct udata *userdata, time_t now, char *topic)
|
||||
utstring_renew(us);
|
||||
utstring_printf(us, "%ld %s\n", now, topic);
|
||||
|
||||
sprintf(mpath, "%s/monitor", JSONDIR);
|
||||
sprintf(mpath, "%s/monitor", STORAGEDIR);
|
||||
safewrite(mpath, utstring_body(us));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -532,7 +532,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
|
||||
/* Now safewrite the last location */
|
||||
utstring_printf(ts, "%s/last/%s/%s",
|
||||
JSONDIR, utstring_body(username), utstring_body(device));
|
||||
STORAGEDIR, utstring_body(username), utstring_body(device));
|
||||
if (mkpath(utstring_body(ts)) < 0) {
|
||||
perror(utstring_body(ts));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user