fix dev subcmd editor

This commit is contained in:
Squibid 2025-12-21 04:23:57 -05:00
parent 1a764d6a14
commit 408de3a337

View file

@ -84,19 +84,16 @@ subcmds_dev(void *, int argc, char *argv[])
add(cwd);
}
} else if (strcmp(argv[1], "edit") == 0) {
wpath = calloc(strlen(conf_state_path()) + 4, sizeof(char));
strcpy(wpath, conf_state_path());
strcat(wpath, "dev");
editor = getenv("EDITOR");
puts(getenv("XDG_CONFIG_DIR"));
return;
if (editor) {
execvp(editor, (char *[]){ editor, wpath, NULL });
goto free_stuff;
if (!editor) {
return;
}
printf("Failed to open editor\n");
free_stuff:
wpath = calloc(strlen(conf_state_path()) + strlen(editor) + 5, sizeof(char));
strcat(wpath, editor);
strcat(wpath, " ");
strcat(wpath, conf_state_path());
strcat(wpath, "dev");
system(wpath);
free(wpath);
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
printf("Help text\n");