Browse Source

Write user-specified config file in config dir

If the pathname given to the -c option is a "naked filename" (that
is, no parent directory and no extension), then transform it into
a pathname to a file in $XDG_CONFIG_HOME/gfsecret.

E.g., "-c config" will write the configuration in
$XDG_CONFIG_HOME/gfsecret/config.conf.
develop
Damien Goutte-Gattat 4 years ago
parent
commit
1d9f6b27a5
  1. 8
      src/gfsec-split.c

8
src/gfsec-split.c

@ -328,6 +328,14 @@ main(int argc, char **argv)
free(base);
}
else if ( ! strchr(config_path, '/') && ! strchr(config_path, '.') ) {
char *tmp;
tmp = xstrdup(config_path);
xasprintf(&config_path, "%s/gfsecret/%s.conf",
getenv("XDG_CONFIG_HOME"), tmp);
free(tmp);
}
if ( (c = gfsec_secret_set_secret_file(cfg, secret_file)) != 0 )
errx(EXIT_FAILURE, "Cannot set secret: %s", gfsec_error_string(c));

Loading…
Cancel
Save