Config path and arguments finished
This commit is contained in:
parent
48d2672dad
commit
b9e62e21a1
1 changed files with 23 additions and 0 deletions
|
@ -28,4 +28,27 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default config path
|
||||||
|
if (!config_path[0]) {
|
||||||
|
char *config_home = getenv("XDG_CONFIG_HOME");
|
||||||
|
if (config_home) {
|
||||||
|
snprintf(
|
||||||
|
config_path,
|
||||||
|
sizeof(config_path),
|
||||||
|
"%s/%s",
|
||||||
|
config_home,
|
||||||
|
CONFIG_FILE
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// ${HOME}/.config as fallback
|
||||||
|
snprintf(
|
||||||
|
config_path,
|
||||||
|
sizeof(config_path),
|
||||||
|
"%s/%s",
|
||||||
|
getenv("HOME"),
|
||||||
|
".config/" CONFIG_FILE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue