mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
external editor: don't use absolute paths and allow path search
This commit is contained in:
parent
69e3cebf26
commit
a5a0dd6c91
@ -9418,15 +9418,11 @@ cmd_editor(ProfWin* window, const char* const command, gchar** args)
|
||||
g_object_unref(fos);
|
||||
|
||||
char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
|
||||
if (!g_file_test(editor, G_FILE_TEST_EXISTS)) {
|
||||
cons_show_error("Editor: binary %s not exist", editor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Fork / exec
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
int x = execl(editor, editor, g_file_get_path(file), (char*)NULL);
|
||||
int x = execlp(editor, editor, g_file_get_path(file), (char*)NULL);
|
||||
if (x == -1) {
|
||||
cons_show_error("Editor:Failed to exec %s", editor);
|
||||
}
|
||||
|
@ -2340,7 +2340,7 @@ _get_default_string(preference_t pref)
|
||||
case PREF_URL_OPEN_CMD:
|
||||
return "xdg-open %u";
|
||||
case PREF_COMPOSE_EDITOR:
|
||||
return "/usr/bin/vim";
|
||||
return "vim";
|
||||
case PREF_URL_SAVE_CMD:
|
||||
return NULL; // Default to built-in method.
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user