1
0
Fork 0

expand ~ to $HOME in /upgrade

Fixes #1460.
This commit is contained in:
Lukas Mai 2023-04-04 11:14:19 +02:00
parent c6ad171fe9
commit ca148a0122
1 changed files with 10 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#include <irssi/src/core/net-sendbuffer.h>
#include <irssi/src/core/pidwait.h>
#include <irssi/src/lib-config/iconfig.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/core/chat-protocols.h>
#include <irssi/src/core/servers.h>
@ -59,13 +60,19 @@ void session_upgrade(void)
static void cmd_upgrade(const char *data)
{
CONFIG_REC *session;
char *session_file, *str;
char *session_file, *str, *name;
char *binary;
if (*data == '\0')
data = irssi_binary;
name = irssi_binary;
else
name = convert_home(data);
if ((binary = g_find_program_in_path(data)) == NULL)
binary = g_find_program_in_path(name);
if (name != irssi_binary)
g_free(name);
if (binary == NULL)
cmd_return_error(CMDERR_PROGRAM_NOT_FOUND);
/* save the session */