feat: support -c option to specified config file

This commit is contained in:
DreamMaoMao
2025-12-03 16:12:05 +08:00
parent a2902a469b
commit 1ffdc1ef38
3 changed files with 22 additions and 4 deletions

View File

@@ -29,7 +29,12 @@ int isdescprocess(pid_t p, pid_t c) {
char *get_autostart_path(char *autostart_path, uint32_t buf_size) {
const char *mangoconfig = getenv("MANGOCONFIG");
if (mangoconfig && mangoconfig[0] != '\0') {
if (cli_config_path) {
char *config_path = strdup(cli_config_path);
char *config_dir = dirname(config_path);
snprintf(autostart_path, buf_size, "%s/autostart.sh", config_dir);
free(config_path);
} else if (mangoconfig && mangoconfig[0] != '\0') {
snprintf(autostart_path, buf_size, "%s/autostart.sh", mangoconfig);
} else {
const char *homedir = getenv("HOME");