Fixed path expand when doing a single '~' when expanding directory entries.

This commit is contained in:
rakshasa
2026-04-15 13:06:01 +02:00
committed by Jari Sundell
parent b7a21b1e9d
commit 4235507292
3 changed files with 4 additions and 36 deletions
+3 -2
View File
@@ -2,6 +2,7 @@
#include "globals.h"
#include <cstdlib>
#include <torrent/exceptions.h>
rpc::ip_table_list ip_tables;
@@ -14,8 +15,8 @@ expand_path(const std::string& path) {
return std::string();
if (path[0] == '~') {
if (path.size() < 2 || path[1] != '/')
throw torrent::input_error("Could not expand ~ in session path, only ~/<path> is supported.");
if (path.size() >= 2 && path[1] != '/')
throw torrent::input_error("Could not expand ~ in session path, only '~' or '~/...' is supported.");
const char* home = std::getenv("HOME");