diff --git a/src/subcmds/dev.c b/src/subcmds/dev.c index c9640d8..5ee1884 100644 --- a/src/subcmds/dev.c +++ b/src/subcmds/dev.c @@ -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");