mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
allow file path to include strftime(3) tokens
This commit is contained in:
parent
f59f40532b
commit
b04df56ddc
1 changed files with 10 additions and 1 deletions
|
@ -35,8 +35,17 @@ int file_parse(config_setting_t *cfg, struct node *n)
|
|||
{
|
||||
struct file *f = alloc(sizeof(struct file));
|
||||
|
||||
const char *out;
|
||||
if (config_setting_lookup_string(cfg, "out", &out)) {
|
||||
time_t t = time(NULL);
|
||||
struct tm *tm = localtime(&t);
|
||||
|
||||
f->path_out = alloc(FILE_MAX_PATHLEN);
|
||||
if (strftime(f->path_out, FILE_MAX_PATHLEN, out, tm) == 0)
|
||||
cerror(cfg, "Invalid path for output");
|
||||
|
||||
}
|
||||
config_setting_lookup_string(cfg, "in", &f->path_in);
|
||||
config_setting_lookup_string(cfg, "out", &f->path_out);
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "mode", &f->mode))
|
||||
f->mode = "w+";
|
||||
|
|
Loading…
Add table
Reference in a new issue