1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

external editor: don't use absolute paths and allow path search

This commit is contained in:
Jörg Thalheim 2021-05-30 22:35:17 +02:00
parent 69e3cebf26
commit a5a0dd6c91
No known key found for this signature in database
GPG Key ID: B3F5D81B0C6967C4
2 changed files with 2 additions and 6 deletions

View File

@ -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);
}

View File

@ -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: